How to make a loader on the site? A request is sent via AJAX, then while it loads the output, we show the loader, well, such as a loading picture. I do not know how to find in the search engine
1 answer
If I understand the question correctly, it is possible, in beforeSend - we show the loader, in complete we hide (jquery):
$.ajax({ url: "...", datatype: "json", cache: false, async: true, contentType: "application/json; charset=utf-8", method: "POST", data: JSON.stringify({ ... }), beforeSend: function () { $("#loader").show(); }, complete: function () { $("#loader").hide(); }, success: function (data, textStatus) { // ... } }); |