Side navigation
#5507 closed bug (duplicate)
Opened November 13, 2009 01:17AM UTC
Closed December 10, 2009 02:59AM UTC
Ajax Fires "Complete" Event Twice (JSONP)
Reported by: | Wardrop | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 1.4 |
Component: | ajax | Version: | 1.3.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
When using $.ajax() for JSONP requests, the "complete" event is fired twice if the JSONP request is from and to the same domain.
You could argue that JSONP shouldn't be used for same-domain JSON requests, but there are circumstances where this does occur for whatever reason, such as in a testing environment where the JSONP resides under the same domain (which may be 'localhost').
This isn't a hard one to reproduce, but here's some sample code anyway...
<script src="jquery-1.3.2.js"></script>
<script>
$.ajax({ type : "GET",
url : <insert url here>,
async : false,
dataType : "json",
complete : function () { alert('complete'); }
});
</script>
Simply replace <insert url here> with a JSONP URL from the same domain the script is run from, and then repeat the test with a JSONP URL from another domain.
Attachments (0)
Change History (1)
Changed December 10, 2009 02:59AM UTC by comment:1
resolution: | → duplicate |
---|---|
status: | new → closed |
Duplicate of #5383.