toastr.clear(); toastr.options = { "closeButton": true, "debug": false, "newestOnTop": true, "progressBar": false, "positionClass": "toast-bottom-center", "preventDuplicates": true, "showDuration": "6000", "hideDuration": "10000", "timeOut": "3000", "extendedTimeOut": "2000" }; $(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://wbchseapp.wb.gov.in/portal/forgot-username-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("Get User ID"); $("button[type='submit']").removeAttr("disabled"); if(data!=0) { toastr.success(" "+data); $(".page-ath-text").removeClass("hide"); $(".ld_st").html(data); $("#st_forgotform").addClass("hide"); } else { $(".ld_st").html(''); toastr.warning(" You entered invalid 10+2 Reg No/ Aadhaar No!"); } }, error: function(xhr, ajaxOptions, thrownError) { $(".ld_st").html(''); toastr.error(' Failed! Something is wrong.'); $("#st_forgotform button[type='submit']").html("Get User ID"); $("#st_forgotform button[type='submit']").removeAttr("disabled"); } }); return false; }); }); $('.allow_name').keypress(function (e) { validationForAllow_name(e); }); function validationForAllow_name(e){ var regex = new RegExp(/^([a-zA-Z\s])+$/); var str = String.fromCharCode(!e.charCode ? e.which : e.charCode); if (regex.test(str)) { return true; } e.preventDefault(); return false; }