This question has already been answered:
I upload data (li) to ul via ajax - a few elements that can be clicked, in consequence of which the elements change color. The data is uploaded perfectly, but the fact is that after they appear, the color change on a click does not occur. I looked in F12 - there the elements li seem to blink (it is possible to load to the end). As soon as they miss, everything works. If you put async: false, then when downloading data, everything hangs, but as soon as data appears, everything works as it should. Tell me please, is it possible at the moment of hangup to display some kind of gif (no matter where) the simulated download? And after downloading, delete it. Thank you all in advance for your help!
j("#dtpk").bind("DOMSubtreeModified", function(){ var date = j("#dtpk").val(); j("ul").addClass("loading"); j.ajax({ type: "POST", url: ajax_bind.ajaxurl, async:true, data: { action: "bind", date: date }, beforeSend: function(){ j("ul").addClass("loading"); }, success: function(html){ j("#time-list").html(html); //<ul id="time-list"> }, complete: function(){ j("ul").removeClass("loader"); } }); });