Hello,
I'm trying to use jQuery's $getJSON to send an array of 'ids'. Here's what my jQuery looks like:
var calendarIds = [];
$("#jammer :selected").each(function(i, selected){
calendarIds[i] = $(selected).val();
});
$.getJSON("test.php", {
start: start.getTime() / 1000,
end: end.getTime() / 1000,
calendarid: calendarIds
},
function(a) {
callback(a);
});
And, when I inspect with Firebug, it shows that multiple values are being passed: e.g.,
http://mydomain.com/test.php?calendarid=3&calendarid=4
However, when I try to join this so-called array using:
$comma_separated = join(",", $_GET['calendarid']);
echo $comma_separated;
I'm getting:
Warning: join() [function.join]: Invalid arguments passed
And, if I just echo $_GET['calendarid'], I'm getting, it only echos the last id passed, e.g.:
echo $_GET['calendarid']; //echos "4"
Any ideas on what I'm doing wrong? Thanks!