The registration page worked fine until I added a modal. The modal lays out a non-disclosure agreement. When the user click the Continue button on the modal, the flow is sent back to the main page. But the ajax no longer processes. The page just sits there.
Firstly, I harvest the input variables from the registration form. If everything there is okay, then it allows the user to click the Registration button, which then shows a modal with an NDA on it. Once they check the “I agree checkbox”, then the Continue button becomes enabled for them to click.
[code=html]
$(‘#register’).click(function(){
var setservice = $(‘#service’).val();
if(setservice == “22”){
$(‘#serviceErr’).html(“Please Select a Service”).show().delay(3000).fadeOut(“slow”);
$(‘#service’).focus();
return false;
}
var setfname = $(‘#fname’).val();
if(setfname == “”){
$(“#fnameErr”).html(“Field cannot be Empty”).show().delay(3000).fadeOut(“slow”);
$(‘#fname’).focus();
return false;
}
var setlname = $(‘#lname’).val();
if(setlname == “”){
$(“#lnameErr”).html(“Field cannot be Empty”).show().delay(3000).fadeOut(“slow”);
$(‘#lname’).focus();
return false;
} …
$(‘#myModal’).modal(‘show’);
$(‘#agree’).click(function(){
/* CHECK THE AGREEMENT BOX */
if ($(‘#agree’).is(‘:checked’)) {
$(‘#continue’).prop(‘disabled’, false);
} else {
$(‘#continue’).prop(‘disabled’, true);
}
});
});
$(‘#continue’).click(function(){
$(‘#myModal’).modal(‘hide’);
$.ajax({
url : ‘register.php’,
type : ‘POST’,
async : true,
data : {
‘register’ : 1,
‘fname’ : setfname,
‘lname’ : setlname,
‘phone’ : setphone,
’email’ : setemail,
‘pwd1’ : setpwd1,
‘timezone’ : settimezone,
‘captcha’ : setcaptcha,
‘service’ : setservice
},
success:function(re){
if(re == “error”){
errorpage();
}
if(re == “0”){
window.location.replace(“https://www.website.com/confirmemail.html”);
}
if(re == “2”){
$(‘#captchaErr’).html(“CAPTCHA Incorrect”).show().delay(3000).fadeOut(“slow”);
$(‘#captcha’).focus();
return false;
}
}
});
});
I’m new to using modals, so I’m sure I’ve done something silly here. Any help would be appreciated. Thanks.