gasparesganga/jquery-loading-overlay

not work in jquery ajax option "async: false"

Closed this issue · 3 comments

function getSuccessOutput() {
$.LoadingOverlay("show"); // this loop infinity

    $.ajax({
        url:'test.php', // test.php return echo 'test call';
        async: false,
        complete: function (response) {
            $('#output').html(response.responseText); // response = 'test call'
        },
        error: function (data) {
            $('#output').html(data);
        },
    });
    $.LoadingOverlay("show");
    return false;
}

Would you care to elaborate a bit more, please?
How is this option even related to LoadingOverlay in first instance? Maybe you can show some relevant code?

I change new code to this, it work

function getSuccessOutput() {
$(document).ajaxStart(function(){
$.LoadingOverlay("show");
});

    $.ajax({
        url:'test.php', // test.php return echo 'test call';
        async: false,
        complete: function (response) {
            $('#output').html(response.responseText); // response = 'test call'
        },
        error: function (data) {
            $('#output').html(data);
        },
    });

   **$(document).ajaxStop(function(){
        $.LoadingOverlay("hide");
    });**
    return false;
}

my language is weak
thank you

Ok, so does it now work as expected?
I'm sorry, this is NOT an issue related to LoadingOverlay, but rather a programming question. You can refer to Example 5.