I have a script that validates and submits using jquery validate and ajax which is working on desktop, but not on mobile. I can't find the problem.
They are going into the click but not further,
Its about two form, which are almost exactly the same but some minor differences. this is my javascript. `
$(document).ready(function() {
$("#offerteSeperateForm #ck-button.submit").click(function() {
$("#offerteSeperateForm").validate({
ignore: ":hidden",
rules: {
name:{
minlength:2,
required:true
},
telephone:{
required:true,
minlength:10,
maxlength:10
},
email:{
required:true,
email: true
},
personen:{
required:true
},
personen:{
required:true,
number: true
},
day:{
required:true,
number: true,
maxlength:2,
max: 31,
min: 0
},
month:{
required:true,
number: true,
maxlength:2,
max: 12,
min: 0
},
year:{
required:true,
number: true,
min: <?php echo date('Y'); ?>
}
},
submitHandler: function (form) {
$.ajax({
var data = $('form#offerteSeperateForm').serialize();
//this is the php file that processes the data and send mail
url: "<?php bloginfo('template_url'); ?>/processOfferteSeperate.php",
//GET method is used
type: "POST",
//pass the data
data: data,
//Do not cache the page
cache: false,
//success
success: function (html) {
//if process.php returned 1/true (send mail success)
if (html==1) {
alert('succes');
window.location = "<?php echo site_url(); ?>/?p=146";
//if process.php returned 0/false (send mail failed)
} else alert('Sorry, er ging iets mis. Wilt u het nogmaals proberen?');
}
});
return false;
}
});
});
$( "#offerteForm #ck-button.submit" ).click(function() {
$("#offerteForm").validate({
ignore: ":hidden",
rules: {
name:{
minlength:2,
required:true
},
telephone:{
required:true,
minlength:10,
maxlength:10
},
email:{
required:true,
email: true
},
personen:{
required:true
},
personen:{
required:true,
number: true
},
day:{
required:true,
number: true,
maxlength:2,
max: 31,
min: 0
},
month:{
required:true,
number: true,
maxlength:2,
max: 12,
min: 0
},
year:{
required:true,
number: true,
min: <?php echo date('Y'); ?>
}
},
submitHandler: function(form) {
$.ajax({
var data = $('form#offerteForm').serialize();
//this is the php file that processes the data and send mail
url: "<?php bloginfo('template_url'); ?>/processOfferte.php",
//GET method is used
type: "POST",
//pass the data
data: data,
//Do not cache the page
cache: false,
//success
success: function (html) {
alert('succes');
//if process.php returned 1/true (send mail success)
if (html==1) {
window.location = "<?php echo site_url(); ?>/?p=146";
//if process.php returned 0/false (send mail failed)
} else alert('Sorry, er ging iets mis. Wilt u het nogmaals proberen?');
}
});
return false;
}
});
});
});
` these are the form tags
<form action="" id="offerteForm" method="post">
<form action="" id="offerteSeperateForm" method="post">