I have a project in which I am using MVC C #, with Bootstrap and FontAwesome.
My goal is to show the spinner and disable the page while waiting for an ajax request.
So far, I have successfully completed this task with the following code:
HTML:
<div id='ajax_loader' style="position: fixed; left: 50%; top: 50%; display: none;">
<img src="~/Images/ajax-loader.gif">
</div>
JS:
function blablabla() {
var modal = $('<div>').dialog({ modal: true });
modal.dialog('widget').hide();
$('#ajax_loader').show();
$.ajax({
type: "Get",
url: url,
success: function (result) {
alert("success! " + result);
},
error: function(result) {
alert("error!" + result);
},
complete: function () {
$('#ajax_loader').hide();
modal.dialog('close');
}
});
}
Now this code works , my page is disabled, and I show the counter.
However , this counter is also unavailable, and I do not want this to happen.
How can I prevent this error?
source
share