aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Web/Tango.MachineService/Scripts/Account/Login.js
blob: fbb21c935d9fbb72bb06f2db03634dc6b3cf7363 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
$(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...";

        $.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";

                }, 1500);
            },
        });

    });

});