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.
58 lines
1.2 KiB
58 lines
1.2 KiB
6 years ago
|
$(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")
|
||
|
},
|
||
|
});
|
||
|
}
|