$(document).ready(function() { $("#st_forgotform").submit(function(){ $("#st_forgotform button[type='submit']").html('Please wait'); $("#st_forgotform button[type='submit']").attr("disabled","true"); $.ajax({ url: "https://dreamnestrealtors.com/forgot-password-action", type: "POST", data: new FormData($("#st_forgotform")[0]), async: true, contentType: false, cache: false, processData:false, success: function(data) { $("#st_forgotform button[type='submit']").html("Send Reset Link"); $("button[type='submit']").removeAttr("disabled"); if(data==1) { alert("Your reset link has been generated successful and sent to your mail id. Click on the link to get the option for setting New Password!"); $(".page-ath-text").removeClass("hide"); $("#st_forgotform").addClass("hide"); } else { alert("You entered invalid email id!"); } }, error: function(xhr, ajaxOptions, thrownError) { alert('Failed! Something is wrong.'); $("#st_forgotform button[type='submit']").html("Send Reset Link"); $("#st_forgotform button[type='submit']").removeAttr("disabled"); } }); return false; }); $("#st_resetform").submit(function(){ $("#st_resetform button[type='submit']").html('Please wait'); $("#st_resetform button[type='submit']").attr("disabled","true"); $.ajax({ url: "https://dreamnestrealtors.com/forgot-password-reset-action", type: "POST", dataType:"json", data: new FormData($("#st_resetform")[0]), async: true, contentType: false, cache: false, processData:false, success: function(data) { toast_type = data.type; $("#st_resetform button[type='submit']").html('Submit'); $("button[type='submit']").removeAttr("disabled"); if(data.type=="success") { $(".page-ath-text").removeClass("hide"); $("#st_resetform").addClass("hide"); } if(toast_type=='success') { alert(data.text); window.location="login"; } else { alert(data.text); } }, error: function(xhr, ajaxOptions, thrownError) { alert('Failed! Something is wrong.'); $("#st_resetform button[type='submit']").html('Submit'); $("#st_resetform button[type='submit']").removeAttr("disabled"); } }); return false; }); }); // For Validation minimum char in Last-Name function validatePassword(password) { var password_val = $("#"+password).val(); var regex = /^([0-9a-zA-Z/#?!@$%^&*-+]){4,30}$/; if(regex.test(password_val)) { //return false; } else{ $("#"+password).val(''); $("#"+password).focus(); alert('Invalid Password. Enter minimum 4 and maximum 30 characters'); } } function validateConfirm_password(confirm_password) { var confirm_password_val = $("#"+confirm_password).val(); var regex = /^([0-9a-zA-Z/#?!@$%^&*-+]){4,30}$/; if(regex.test(confirm_password_val)) { //return false; } else{ $("#"+confirm_password).val(''); $("#"+confirm_password).focus(); alert('Invalid Confirm Password. Enter minimum 4 and maximum 30 characters'); } }