Side navigation
#4086 closed bug (fixed)
Opened February 06, 2009 11:02AM UTC
Closed May 10, 2009 02:42AM UTC
$().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 (4)
Changed February 07, 2009 02:02AM UTC by comment:1
Changed February 07, 2009 02:37PM UTC by comment:2
Yes, here you can test it online:
http://www.mma-studio.com/jQueryLoadTestCase/
I've also attached this as rar archive.
Changed February 09, 2009 12:58PM UTC by comment:3
I find this problem today, can someone verify it?
Changed May 10, 2009 02:42AM UTC by comment:4
resolution: | → fixed |
---|---|
status: | new → closed |
The
jQuery.loadmethod calls
jQuery.ajaxwith 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
loadwould work and the others would fail.
Instead of using
jQuery.ajaxSettingsto 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?