Can you still do this in jquery 1.4?
I had this in jquery version 1.3
// ajax requests woul开发者_JS百科d get this method
$().ajaxStart(function (e)
{
$('body').css('cursor', 'progress');
});
Can you still do this. Every time I look though firebug and put break points these never get run. Do I have to move them now to the ajaxSetup?
From the docs:
Whenever an Ajax request is about to be sent, jQuery checks whether there are any other outstanding Ajax requests. If none are in progress, jQuery triggers the ajaxStart event. Any and all handlers that have been registered with the .ajaxStart() method are executed at this time.
Could it be that you have an Ajax request in progress?
EDIT: possibly use $(document).ajaxStart
too instead of $().ajaxStart
, saw this mentioned in the comments on the jQuery site.
You need to do this in 1.4:
$(document).ajaxStart(function (e) {
$('body').css('cursor', 'progress');
});
Pre 1.4 $()
was a jQuery set containing document
, now it is actually an empty set...so there's no element to bind the ajaxStart
event to, you need to explicitly put document
in there now. You can find a full list of breaking changes in 1.4 here.
精彩评论