summaryrefslogtreecommitdiff
path: root/src/client/user_login.js
blob: a77790ac04ceecdb6734181dac9563ae103bc207 (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
"use strict"

function submit_login_form() {
    var data = {
        email_address : $('#login_email_address').val(),
        password : $('#login_password').val()
    };

    // TODO: validate

    $.ajax({
        type : "POST",
        url: '/login',
        async : false,
        cache : false,
        data : JSON.stringify(data),
        dataType : 'json',
        contentType : "application/json; charset=utf-8",
        success : function () {
            document.location = "/index";
        },
        error : function (xhr, status, err_thrown) {
            $('#failed-login').show();
        }
    });
}