I'm doing a simple AJAX post using jQuery, works great:
var parameters = {firstName: 'John', lastName: 'Smith'};
$.post('http://api.example.com/rest', parameters, function(data) {
alert('Response: ' + data.someResult);
});
However, when I add an array to the parameters like so:
var parameters = {firstName: 'John', lastName: 'Smith', children: ['Susy', 'Billy']};
Then the problem is the parameter name children gets changed to children[] (it's actually URL encoded to children%5B%5D) when POSTing to the server. I can't change the server to look for parameters with the name children[] so what do I do? How can I POST multiple values with the name children? Why is jQuery changing the name of my parameter?