I need to post data to a URL like this:
http://www.your_domain.com/checkout/cart/add?product=68&qty=1&super_attribute[528]=55&super_attribute[525]=56
See here for Magento documentation on query string
My current code looks like this, but it is not working.
var myObject = {
super_attribute: {configOptionSuperAttribute: configOption}
};
jQuery.post(productAddToCartURL, { product: productId, qty: qty, super_attribute: jQuery.param(myObject) })
.done(function(data) {
alert("Data Loaded: " + data);
});
The issue is with the super_atribute[]. How do I make myObject compatible?
Thanks for the help!
configOption? Is it an array or object? How does it look like? The data is serialized usingjQuery.param(api.jquery.com/jQuery.param). Have a look at the documentation to find out how to structure your object.jQuery.paramin your code or just now because I mentioned it? You should not call it explicitly, it's called internally by jQuery to serialize the whole data object.myObjectin your update has to look likeconfigOptionin my answer. Don't make it more complicated than it is ;)