I\'ve got a php array:
$toField = explode(\",\", $ids); //Which looks something like \'24,25,26,29\'
I want to pass this array via jQuery AJAX
First, you probably want to use implode, and not explode, to construct your $toField variable ;-)
$ids = array(24, 25, 26, 29);
$toField = implode(',', $ids);
var_dump($toField);
Which would give you
string '24,25,26,29' (length=11)
You then inject this in the form ; something like this would probably do :
(Chech the HTML source of your form, to be sure ;-) )
Then, on the PHP script that receives the data from the form when it's been submitted, you'd use explode to extract the data as an array, from the string :
foreach (explode(',', $_POST['receiverID']) as $receiverID) {
var_dump($receiverID);
}
Which will get you :
string '24' (length=2)
string '25' (length=2)
string '26' (length=2)
string '29' (length=2)
And, now, you can use thoses ids...