Page 1 of 1
Sending array values to javascript
Posted: Tue Feb 12, 2008 7:21 am
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
Re: Sending array values to javascript
Posted: Tue Feb 12, 2008 9:20 am
by superdezign
What does the function, "SendValues()," do?
Re: Sending array values to javascript
Posted: Tue Feb 12, 2008 1:19 pm
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?
Re: Sending array values to javascript
Posted: Tue Feb 12, 2008 4:36 pm
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?