I need help to prepare parameters for $.ajax submit.
I have multiple pairs of html inputs (i pairs):
> <input type="hidden" value="31" name="product_id"> <input
> type="hidden" value="3" name="quantity">
>
> <input type="hidden" value="34" name="product_id"> <input
> type="hidden" value="1" name="quantity">
if I use this jquery code:
function send(){
var parameter1 =$("input[name$='product_id']").serialize();
var parameter2 = $("input[name$='quantity']").serialize();
$.ajax({
type: "POST",
url: 'index.php?route=checkout/cart/add',
data: parameter1+'&'+parameter2
});
};
I send parameters like this:
product_id=31&product_id=30&quantity=2&quantity=2
How pass parameters like this:
product_id=31&quantity=2&product_id=30&quantity=2
Thanks