jquery - building a list and sending to an AJAX method -
i building list array pass via ajax using data parameter.
everything looks when write out list console, ajax method doesn't it.
for (i = 0; < carlist.length; i++) { var cardata = { "data": { "carid": '"' + carlist[i] + '"', "passengercar": "true", "automatic":"true" } }; console.log(cardata); } $.ajax({ datatype: "json", data: cardata ....
am doing improper?
thanks
var cardata = {}; (i = 0; < carlist.length; i++) { cardata["data_"+i] = { carid : carlist[i], passengercar: true, automatic : true }; } $.ajax({ url : 'someurl.php', datatype: 'json', //expects returned data server json data : cardata }).done(function(data) { console.log(data); });
Comments
Post a Comment