I have an associative array
var order = [];
order['id'] = 1266;
order['customer'] = [];
order['customer']["firstName"] = "John";
order['customer']["lastName"] = "Doe";
order['customer']["age"] = 46;
I want to send this array as data into my ajax call
$.ajax({
url : 'http:example.com',
method : 'post',
dataType : 'json',
data : order,
success : function() {
}
})
Ajax are calling my url properly but sending empty data. I have tried
- JSON.stringify(order)
- data : {'order' : order}
- data : {'order' : JSON.stringify(order)}
But none of these are working