Sending array values to javascript

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
thatsme
Forum Commoner
Posts: 87
Joined: Sat Apr 07, 2007 2:18 am

Sending array values to javascript

Post by thatsme »

Code: Select all

<input type='text' name='ans[]' id = 'ans' value=$ans[$i]>
How to send ans values to javascript function?

I tried,

Code: Select all

<input type='submit' name='submit' value='submit' onClick='SendValues(ans)'>
, without any success.

Thanks
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Re: Sending array values to javascript

Post by superdezign »

What does the function, "SendValues()," do?
thatsme
Forum Commoner
Posts: 87
Joined: Sat Apr 07, 2007 2:18 am

Re: Sending array values to javascript

Post by thatsme »

it is an ajax function which will send those values to ajax.php for insert/updated those values. I also tried document.getElementById. Another thing i would like to know, if i use get method in ajax, can i send more values like descriptions etc?
User avatar
JellyFish
DevNet Resident
Posts: 1361
Joined: Tue Feb 14, 2006 7:18 pm
Location: San Diego, CA

Re: Sending array values to javascript

Post by JellyFish »

So long as ans is defined in javascript you should be able to pass it to SendValues(). Where are you defining ans as an array?
Post Reply