Arun Nandha Arun Nandha - 9 days ago 7
Javascript Question

ajax request is not stopping

here is my ajax call

$.ajax({
url: "AutoRFQ_Vendors_ST.aspx/BindVesselGrid",
type: "POST",
timeout: 3000,
data: JSON.stringify(sendingdata),
contentType: "application/json",
success: function (data) {
//do something
}


here is my css loader

ajaxStart: function () { $body.addClass("loading"); },
ajaxStop: function () { $body.removeClass("loading"); }


when i make a ajax call which respond
d:''
an empty string but my
ajaxstop:
event is not firing any idea.
Thanks in advane

Answer

You have to hide your loader on ajax() complete like:

ajax({
    complete: function(){
        $body.removeClass("loading");
    }
});

complete executes after either the success or error callback were executed.