var eVisa = eVisa || {}; var $app = { context: "" }; eVisa.ResendActivationLink = { init: function () { $app.context = this; this.sendLink(); this.createRequestObj(); }, createRequestObj: function () { var obj = {}; obj.Email_Id = $('#emailId').val(); obj.CaptchaCode = $('#CaptchaCode').val(); return obj; }, sendLink: function () { $("#btnSendLink").click(function (e) { e.preventDefault(); $('#divOtpSuccessMsg').html(''); $('#divOtpSuccessMsg').hide(); $('#divOtpFailureMsg').html(''); $('#divOtpFailureMsg').hide(); if ($('#formResendActivationLink').valid()) { var requestObj = $app.context.createRequestObj(); if (!captchaManager.IsCaptchaValid(captchaObj)) return; //$('#divOverlay').show(); ajaxindicatorstart(); $.ajax({ url: siteRoot + "Registration/ResendActivationLink", type: "POST", data: { viewModel: requestObj, //emailId: $('#emailId').val(), __RequestVerificationToken: $('input[name="__RequestVerificationToken"]').val() }, success: function (data) { //$('#divOverlay').hide(); ajaxindicatorstop(); if (data.success) { window.location.href = siteRoot + "Login/Index"; $('#divOtpSuccessMsg').html(data.message); $('#divOtpSuccessMsg').show(); setTimeout(function () { window.location.href = siteRoot + 'Login'; }, 2000); } else { $('#divOtpFailureMsg').html(data.message); $('#divOtpFailureMsg').show(); refreshCaptcha(); $('html, body').animate({ scrollTop: $("#divOtpFailureMsg").offset().top }, 500); } }, error: function (err) { ajaxindicatorstop(); $('#divOverlay').hide(); refreshCaptcha(); console.log(err); } }); } }); } }