var wnioskiRequest = null;
var wnioskiRequestRunning = false;

function wnioskiZastepcaList() {

    if (wnioskiRequestRunning) {
        wnioskiRequest.abort();
        wnioskiRequestRunning = false;
    }
    wnioskiRequest = $.ajax({
        type: "GET",
        url: local_url + "ajax/api/wnioski_zastepca/?no_cache=" + ((new Date()).getTime()),
        dataType: "html",
        beforeSend: function () {
            showLoader($('#table2-loading'));
            wnioskiRequestRunning = true;
        }
    }).done(function (response) {
        wnioskiRequestRunning = false;
        $('[data-container="table2"]').html(response);
        hideLoader($('#table2-loading'));
    });
}

$(document).ready(function () {
    wnioskiZastepcaList();
});