Added ability to hide ajax loading alert (#90)

This commit is contained in:
Roman Kelesidis 2023-04-01 00:40:43 +07:00 committed by GitHub
parent d3f7d586d5
commit 770ca6d229
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -314,10 +314,12 @@ Ajax.prototype = {
request: {}, // request data
params: {}, // action params, format: ajax.params[ElementID] = { param: "val" ... }
form_token: '',
hide_loading: null,
exec: function (request) {
exec: function (request, hide_loading = false) {
this.request[request.action] = request;
request['form_token'] = this.form_token;
this.hide_loading = hide_loading;
$.ajax({
url: this.url,
type: this.type,
@ -445,12 +447,16 @@ Ajax.prototype = {
$(document).ready(function () {
// Setup ajax-loading box
$("#ajax-loading").ajaxStart(function () {
if (ajax.hide_loading === false) {
$("#ajax-error").hide();
$(this).show();
ajax.setStatusBoxPosition($(this));
}
});
$("#ajax-loading").ajaxStop(function () {
if (ajax.hide_loading === false) {
$(this).hide();
}
});
// Setup ajax-error box