Home › Forums › JavaScript › Rewritten: jQuery / How do I use an array › Re: Rewritten: jQuery / How do I use an array
June 21, 2009 at 5:01 am
#59409
davesgonebananas
Member
Quote:
$.post(‘/link/to/file/’, {data : checkData.join(‘, ‘)} );
That is not the best way to send data to a php script.
The most efficient way is to use a subscripted variable, this way the data will be accessible as an array in the php script.
For example:
Code:
$.post(‘/link/to/file/’, { ‘data[]’ : checkData });
Now in php the posted data will be available as an array:
$_POST[0]
$_POST[1]
etc…