aboutsummaryrefslogtreecommitdiff
path: root/scripts/util.js
blob: d70c01218b065ba5c1f77c442076048928ca7940 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
function get_login_form() {
    var request = new XMLHttpRequest();
    request.open('GET', '/login/', true);
    request.onload = function() {
        if (request.status >= 200 && request.status < 400) {
            var data = 
            for(var i in data) {
                var u = data[i]['fields']['part_number'] + ' - ' + data[i]['fields']['part_name']
                choices.push({ value: String(data[i].pk), label: u, });
            }
            populateParts(choices);
        } else {
            console.log("server error");
        }
    };
    request.onerror = function() {
        console.log("error on request");
    };
    request.send();
}