Bug Tracker

Opened 13 years ago

Closed 13 years ago

#5507 closed bug (duplicate)

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:


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



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.

Change History (1)

comment:1 Changed 13 years ago by dmethvin

Resolution: duplicate
Status: newclosed

Duplicate of #5383.

Note: See TracTickets for help on using tickets.