I have tried to send one of the key to data parameter as anonymous function, but whatever datatype it returns, Jquery doesn't pass it to server.
Examples:
$.ajax({
type: 'post',
url: 'http://host.com/cart',
dataType: 'html',
data: {
'quantity': function () {
var return_obj = [];
return_obj['1:YTowOnt9'] = '1';
return return_obj;
},
'action': 'cart-update-quantity'
},
success: function(data) {
console.log(data);
}
});
this has the action POST key, however quantity key is empty string. I tried also as string and object.
This example is working:
$.ajax({
type: 'post',
url: 'http://host.com/cart',
dataType: 'html',
data: {
'quantity': {
'1:YTowOnt9': '1'
},
'action': 'cart-update-quantity'
},
success: function(data) {
console.log(data);
}
});
How can I send anonymous function to quantity key in data? The anonymous function will get some of the form inputs dinamically. I also have tried jQuery serializeArray, but it send the data wrong.
ajaxcall.Array.lengthequals zero to non number keys is a big point.