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://fetadmission.jcdigits.in/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)
{
toastr.success(" 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
{
toastr.warning(" You entered invalid email id!");
}
},
error: function(xhr, ajaxOptions, thrownError) {
toastr.error(' 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://fetadmission.jcdigits.in/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')
{
toastr.success(''+data.text);
}
else
{
toastr.warning(''+data.text);
}
},
error: function(xhr, ajaxOptions, thrownError) {
toastr.error(' 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();
toastr.warning(' 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();
toastr.warning(' Invalid Confirm Password. Enter minimum 4 and maximum 30 characters');
}
}