I am trying to display the ajax spinner in modal dialog. I have an ajax spinner already in my page in one of the ajax action for which initially I have coded it using the following code.
$(document)
.ajaxStart(function () {
$loading.show();
})
.ajaxStop(function () {
$loading.hide();
});
But this is too generic, now I want to show the spinner in one of the modal popup and I tried using the following code
$('#modal_loading_div').bind("ajaxStart", function(){
alert('In ajax Start of modal dialog');
$modalLoading.show();
});
$('#modal_loading_div').bind("ajaxStop", function(){
alert('In ajax Stop of modal dialog');
$modalLoading.hide();
});
The above code is not called single time and control is not flowing. As an immediate tweak I tried my way doing this
$(document)
.ajaxStart(function () {
if(dialog){
$('#delete_loading_div').show();
}else{
$loading.show();
}
})
.ajaxStop(function () {
if(dialog){
$('#delete_loading_div').hide();
}else{
$loading.hide();
}
});
but want to know the right way to do this. I am using the jquery-2.1.4