// JavaScript Document $(function(){ $('.modal').on('show.bs.modal', function (event) { //console.log("open"); $("body").css("overflow", "hidden"); }); $('.modal').on('hide.bs.modal', function (event) { //console.log("hide"); $("body").css("overflow", "auto"); }); $('#LiStudentSignUpBtn').click( function (e) { var thisform = $('#LiStudentSignUpForm'); $.post('_ajax.php', { ajax: 'checkEmail', type: 'student', email: $('input[name="email"]', thisform).val(), mobno: $('input[name="mobno"]', thisform).val(), password: $('input[name="password"]', thisform).val() }, function (json) { var json = JSON.parse(json); var error = false; $('.error').hide(); if (!$('input[name="email"]', thisform).val()) { $("#emailError", thisform).show(); error = true; } else { if (!/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/.test($('input[name="email"]', thisform).val())) { $("#emailError2", thisform).show(); error = true; } else { if (json.email_status == true || json.user_status == true) { $("#emailError3", thisform).show(); error = true; } } } if (!$('input[name="mobno"]', thisform).val()) { $("#mobnoError", thisform).show(); error = true; } else { var num = $('input[name="mobno"]', thisform).val(); if ($.isNumeric(num) == false) { $("#mobnoError2", thisform).show(); error = true; } else if (json.mobno_status == true) { $("#mobnoError3", thisform).show(); error = true; } } if (!$('input[name="password"]', thisform).val()) { $("#passwordError", thisform).show(); error = true; } else { if(json.password_status == false){ $("#passwordBox", thisform).hide(); $("#passwordError4", thisform).show(); error = true; } if ($('input[name="password"]', thisform).val().length < 8) { $("#passwordError3", thisform).show(); error = true; } if (!$('input[name="repassword"]', thisform).val()) { $("#repasswordError", thisform).show(); error = true; } if ($('input[name="password"]', thisform).val() && $('input[name="repassword"]', thisform).val()) { if ($('input[name="password"]', thisform).val() != $('input[name="repassword"]', thisform).val()) { $("#passwordError2", thisform).show(); error = true; } } } if (error == false) { $('#LiFullbg').fadeIn(500,function(){ $('#LiStudentSignUpForm').submit(); }); //return true; } else { //return false; } } ); }// ); $('#LiTutorSignUpBtn').click( function (e) { var thisform = $('#LiTutorSignUpForm'); //console.log($('input[name="email"]',thisform).val()); $.post('_ajax.php', { ajax: 'checkEmail', type: 'tutor', email: $('input[name="email"]', thisform).val(), mobno: $('input[name="mobno"]', thisform).val(), password: $('input[name="password"]', thisform).val() }, function (json) { var json = JSON.parse(json); var error = false; $('.error').hide(); if (!$('input[name="email"]', thisform).val()) { $("#emailError", thisform).show(); error = true; } else { if (!/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/.test($('input[name="email"]', thisform).val())) { $("#emailError2", thisform).show(); error = true; } else { if (json.email_status == true || json.user_status == true) { $("#emailError3", thisform).show(); error = true; } } } if (!$('input[name="mobno"]', thisform).val()) { $("#mobnoError", thisform).show(); error = true; } else { var num = $('input[name="mobno"]', thisform).val(); if ($.isNumeric(num) == false) { $("#mobnoError2", thisform).show(); error = true; } else if (json.mobno_status == true) { $("#mobnoError3", thisform).show(); error = true; } } if (!$('input[name="password"]', thisform).val()) { $("#passwordError", thisform).show(); error = true; } else { if(json.password_status == false){ $("#passwordBox", thisform).hide(); $("#passwordError4", thisform).show(); error = true; } if ($('input[name="password"]', thisform).val().length < 8) { $("#passwordError3", thisform).show(); error = true; } if (!$('input[name="repassword"]', thisform).val()) { $("#repasswordError", thisform).show(); error = true; } if ($('input[name="password"]', thisform).val() && $('input[name="repassword"]', thisform).val()) { if ($('input[name="password"]', thisform).val() != $('input[name="repassword"]', thisform).val()) { $("#passwordError2", thisform).show(); error = true; } } } if (error == false) { $('#LiFullbg').fadeIn(500,function(){ $('#LiTutorSignUpForm').submit(); }); //return true; } else { //return false; } } ); } ); $('#LiLoginBtn').click( function(){ var thisform = $('#LiLoginForm'); var error = false; $('.error').hide(); if (!$('input[name="email"]', thisform).val()) { $("#emailError", thisform).show(); error = true; } else if (!/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/.test($('input[name="email"]', thisform).val())) { $("#emailError2", thisform).show(); error = true; } if(!$('input[name="password"]',thisform).val()){ $("#lpasswordError").show(); error = true; }else{ if($('input[name="password"]',thisform).val().length < 8){ $("#lpasswordError2",thisform).show(); error = true; } } if(error == false){ $('#LiLoginForm').submit(); } } ); $('#LiForgetBtn').click( function(){ var thisform = $('#LiForgetForm'); var error = false; $('.error').hide(); if(!$('input[name="email"]',thisform).val()){ $("#emailError",thisform).show(); error = true; }else{ if(! /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/.test($('input[name="email"]',thisform).val())){ $("#emailError2",thisform).show(); error = true; } } if(error == false){ $('#LiForgetForm').submit(); } } ); });