In the following code when I pass static value in testArr for instance, [2, 3]; I get testArr[0] => 2 and testArr[1] => 3 which is correct. However if I pass dynamic value to testArr for instance test; I get testArr[0] => 2,3. I could not figure out the problem. Please help.
var test = '1' + ',' + '2'; $.ajax({ url : url, type : "post", data : { 'testArr[]' : [test] }, success : function(response) { alert(response); } });
testArr[0] => '1,2'? as that is what you are sending, a string with a one, a comma and a two!