JQuery plugin for displaying "loading" awaiting AJAX response

I wrote some jQuery ajax code where I send a request to the server when changing the drop down parameter. Based on this change, 4 or 5 text fields change their data, and many new images are loaded. Everything feels great.

But I was wondering if there is a plugin provided by jQuery that will make the page dark ... show "load" or a counter for a quick second until the request returns from the server? I remember that I saw him, but could not find him.

+3
source share
2 answers

, ajax ajaxStart ajaxStop. , ajax.

ajaxStart ( )
, Ajax, Ajax.

ajaxStop ( )
, Ajax-.

, :

$("#loading").bind("ajaxStart", function(){
    $(this).show();
}).bind("ajaxStop", function(){
    $(this).hide();
});

#loading div , , - lightbox BlockUI, - , .

, , , script, .

BlockUI, , , :

$().ajaxStart($.blockUI).ajaxStop($.unblockUI);
+11

jQuery Ajax ajaxStart() ajaxComplete()

Ajax Events

0

Source: https://habr.com/ru/post/1717404/


All Articles