< Back to Code Samples
// JavaScript Document
var UNDEFINED;
window.onload = function() {
    // 
    getAllSlots();
    document.getElementById('ddl_student').selectedIndex = 0;
    document.getElementById('ddl_slot').selectedIndex = 0;
}

function status(message) {
    if (message != UNDEFINED) {
        document.getElementById('status').innerHTML = message;
    }
}
function loading() {
    document.getElementById('output').innerHTML = '<img class="loader" src="/pub/img/ajax-loader.gif" />';
}

function getAllSlots() {
    status("All Testing Slots");
    loading();
    makerequest("processor.php?action=reportAllSlots", document.getElementById('output'));
}
function getAllRes(){
    status("All Reservations");
    loading();
    makerequest("processor.php?action=reportAllRes", document.getElementById('output'));
}
function getStudent(username){
    if (username == UNDEFINED) {
        var obj = document.getElementById('ddl_student');
        username = obj.options[obj.selectedIndex].value;
    }
    if(username != 0) {
        status("Single Student View (" + username + ")");
        loading();
        makerequest("processor.php?action=reportStudent&username=" + username + "&", document.getElementById('output'));
    }
}
function getSlot(slot_id){
    if (slot_id == UNDEFINED){
        var obj = document.getElementById('ddl_slot');
        slot_id = obj.options[obj.selectedIndex].value;
    }
    if(slot_id != 0) {
        status("Single Slot View (#" + slot_id + ")");
        loading();
        makerequest("processor.php?action=reportSlot&slot_id=" + slot_id + "&", document.getElementById('output'));
    }
}