Hi every one I need to send an array as the data of a post request using $.ajax, this array is a key value array, e.g
fields['BrandName'] = "Fiat,BMW"
fields['year'] = "2004,2005"
i tried this
$.ajax({
type: "POST",
url: url,
dataType: 'json',
data: {'adfields[]': fields},
success: function(data){
alert("passed");
},
error: function(data, status){
alert("error has occurred");
}
});
but it doesn't work, I watch the request using wireshark, but nothing gets sent in the request, something else when I try to do fields.length .. i get zero although fields['BrandName'] is defined and has a value Any help ??
fieldsin the first place? It looks like you are confusing Arrays and Objects.