You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
1.3 KiB

$(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( $(this).parent().siblings('input').val() ) ;
// If is not undefined
// $('#quantity').val(quantity + 1);
$(this).parent().siblings('input').val(quantity + 1)
// Increment
});
$('.quantity-left-minus').click(function(e){
// Stop acting like a button
e.preventDefault();
// Get the field name
var quantity = parseInt( $(this).parent().siblings('input').val() ) ;
// If is not undefined
// Increment
if(quantity>0){
$(this).parent().siblings('input').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")
},
});
}