jQuery ajaxStart
I have the following in my code, but I'm n开发者_C百科ot getting an alert message, even though I can see the $.ajax call is working correctly.
(function($)
{
$('.debug').ajaxStart(function() { alert('ajaxStart'); });
}
)(jQuery);
And of course, in the html, I have:
<div class="debug">
<h3>debug info:</h3>
</div>
Maybe it's because I use:
google.load("jquery", "1");
google.setOnLoadCallback(OnLoad);
Yeah, that was it. I changed it to:
jQuery(function($) {
});
and it worked.
You made mistake in code ;)
(function($)
{
$('.debug').ajaxStart(function()
{
alert('ajaxStart');
});
}(jQuery));
You closed the first bracket after anonymous function, but you had to do that after (jQuery).
For example:
( function($){ body }(jQuery) );
精彩评论