The goal: run some functions on .ajaxStart()
but only if fired by a certain event.
The code:
$('#loading_indicator').ajaxStart(function() {
if(event != null){
if(event.type == 'hashchange' || event.type == 'DOMContentLoaded'){
$(this).show();
$('#acontents').hide();
$(this).ajaxComplete(function() {
$(this).hide();
$('#acontents').show();
bindClickOnTable();
initFilterInput();
});
}
}
});
The problem: This does not work in Firefox. In Internet Explorer and Chrome I can happily access the event object without passing it to the .ajaxStart(function()
. In Firefox however, the event object is undefined
.
The obvious but incorrect solution: pass the event
object to the function. this will not work because it will pass the ajaxStart event and my checks will not work anymore.
The question: How do I make the global event object accessible within this function?
You can store event Object in any variable than can use in other function.
Here is the demo : http://jsfiddle.net/cVDbp/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With