$(document).ready(function(){ var quantitiy=0; $('.quantity-right-plus').click(function(e){ // Stop acting like a button e.preventDefault(); // Get the field name var quantity = parseInt($('#quantity').val()); // If is not undefined $('#quantity').val(quantity + 1); // Increment }); $('.quantity-left-minus').click(function(e){ // Stop acting like a button e.preventDefault(); // Get the field name var quantity = parseInt($('#quantity').val()); // If is not undefined // Increment if(quantity>0){ $('#quantity').val(quantity - 1); } }); }); function submitOrder(){ var data = new FormData(); data.append('candy1', $('#candy1').val()); data.append('candy2', $('#candy2').val()); data.append('candy3', $('#candy3').val()); data.append('candy4', $('#candy4').val()); $.ajax({ url: 'order', type: 'POST', cache: false, data: data, contentType: false, processData: false, success: function() { alert("ok") }, fail: function() { alert("not ok") }, }); }