I want to collect a series of IDs on a page and then push them through to a PHP script as a comma separated list. In a nutshell
for each row
save the userID into an array
implode/join the array values by a comma
send to php script
I have
var userids = $();
$('tr.am').each(function(i,row){
var rowid = $(row).attr('id');
var row_id = rowid.split('_');
userids = userids.add( row_id[3] );
});
// need to join userids to get 1,2,3,4,5 etc.
$.getJSON("includes/script.inc.php", {uid: userids, y: yr, m: mth}, function(data) {
etc.
With an array I would use userids.join(','); but this isn't an array as such but using the jQuery object (I found this idea/method whilst looking for something else and read it was better to use than creating an Array).
Anyone got an idea how I can take userids and get them into a comma separated values string?
TIA
