I'm making a simple post:
jQ.post(url, {id:1, id:2, id:3});
However, jQuery only posts one of the "id" parameters, value 3 being the latest it sends id=3. How to make it send all of them, so the output is without array brackets?
id=1&id=2&id=3
I'm making a simple post:
jQ.post(url, {id:1, id:2, id:3});
However, jQuery only posts one of the "id" parameters, value 3 being the latest it sends id=3. How to make it send all of them, so the output is without array brackets?
id=1&id=2&id=3
Send an array
jQ.post(url, {ids:[1, 2, 3]});
To do this:
var obj = {id: [1,2,3]};
var serializedObj = $.param(obj, true);
$.post(url,serializedObj,function(){});
Original answer by Kevin Bowersox JQuery parameter serialization without the bracket mess