$(document).ready(function () { var state = false; //$("input:text:visible:first").focus(); $('#accesspanel').on('submit', function (e) { e.preventDefault(); state = !state; document.getElementById("litheader").className = "poweron"; document.getElementById("go").className = ""; document.getElementById("go").value = "Initializing..."; $('#accesspanel').css("cursor", "wait"); $("#go").attr("disabled", true); $('#go').css("cursor", "wait"); $.ajax({ type: "POST", url: "Login", // The key needs to match your method's input parameter (case-sensitive). data: JSON.stringify({ Email: $("#email").val(), Password: $("#password").val() }), contentType: "application/json; charset=utf-8", success: function (data) { window.location.href = "/Downloads/index"; }, error: function (errMsg) { document.getElementById("litheader").className = ""; document.getElementById("go").className = "denied"; document.getElementById("go").value = "Access Denied"; setTimeout(function () { document.getElementById("litheader").className = ""; document.getElementById("go").className = ""; document.getElementById("go").value = "Authorize"; $('#accesspanel').css("cursor", "auto"); $("#go").attr("disabled", false); $('#go').css("cursor", "auto"); }, 1500); }, }); }); });