Skip to content

Loading bar behaves strange if one request was aborted and another started right away. #2

@qchroman

Description

@qchroman

Hello,

I have noticed that if you abort one ajax request and start a new one the bar gets hidden and stays hidden for the whole second AJAX request and only when it completes the bar appears and completes its journey across the top of the screen.

If you add something like that into the code the bar doesn't disappear and waits for the second AJAX request to finish before completing.

$(document).on('ajaxComplete.' + PLUGIN_IDENTIFIER, function (e, xhr) {
    if (xhr.statusText == 'abort')
        return;

    if($.active < 2) {
        methods.complete();
    }
});

Another thing is that when you abort the request the ajaxError is called and bar turns red. But it doesn't go back to the color I have set in the CSS when second request is fired. It stays red. I ended up adding this check for abort event into the ajaxError as well.

Other than that, it's an awesome script and thank you very much for that!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions