开发者

jQuery ajaxStart

开发者 https://www.devze.com 2022-12-21 06:32 出处:网络
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.

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) );

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号