How is it possible to add a variable to the name of the data field I want to send information to through ajax.
Here's an example of my code.
var qty = $('#qty_'+value).val();
$.ajax({
url: 'ajax/save_order-2.php?id='+value,
type: 'POST',
data: {
qty_'+value': qty
},
dataType: 'HTML',
success: function(order_info_response){
console.log(order_info_response);
}
});
How do I attach the variable "value" to the data name "qty" just like I did with the var qty.
What is the proper format for doing this without getting Syntax Error?