Opened 14 years ago
Closed 14 years ago
#4086 closed bug (fixed)
$().load() & $.ajaxSetup bug
Reported by: | mk | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | 1.3.2 |
Component: | ajax | Version: | 1.3.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
In my main .js file i have this line (I use it to show loading image at beginning of ajax request and hide it when it finishes).
$.ajaxSetup({dataType:'json', beforeSend:function() { loading.show(); }, complete:function() { loading.hide(); }})
It works fine with $.post(), $.get()... but when using $().load() it will only show loading, it won't hide it. I tried to put alert() instead of loading functions, only one alert is shown.
Attachments (1)
Change History (5)
comment:1 Changed 14 years ago by
comment:2 Changed 14 years ago by
Yes, here you can test it online: http://www.mma-studio.com/jQueryLoadTestCase/
I've also attached this as rar archive.
comment:4 Changed 14 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
The jQuery.load
method calls jQuery.ajax
with its own complete handler, which overrides the one that would have come in through jQuery.ajaxSettings
. However, if you were to have used the success handler then load
would work and the others would fail.
Instead of using jQuery.ajaxSettings
to set handlers, you should be using the ajax global events such as ajaxComplete. I've edited the docs to make this a bit clearer.
Can you provide a test case?