Bug Tracker

Opened 12 years ago

Closed 11 years ago

#8398 closed bug (fixed)

regression: invalid label on repeat ajax request

Reported by: dmuir Owned by:
Priority: low Milestone: 1.6.4
Component: ajax Version: 1.5.1
Keywords: Cc: jaubourg
Blocked by: Blocking:


When a repeat ajax request expects a json response, the json parsing fails on the 2nd response.

http://jsfiddle.net/fMt3t/9/ Works in 1.4.2, but doesn't work in any version of jQuery since.

Might be related to: http://bugs.jquery.com/ticket/7461

Change History (8)

comment:1 Changed 12 years ago by dmuir

Deleting jsonp and jsonpCallback from the repeated request fixes it:

Likewise, setting jsonp and jsonCallback to null on the original request fixes it:

Lastly, using jQuery.ajaxSetup() to remove jsonp and jsonpCallback

Last edited 12 years ago by dmuir (previous) (diff)

comment:2 Changed 12 years ago by jaubourg

Your json request gets promoted to a jsonp request the second time around because you now have the jsonp and jsonpCallback options from ajaxSettings in there.


comment:3 Changed 12 years ago by jaubourg

Cc: jaubourg added

comment:4 Changed 12 years ago by dmuir

But why are those options being added? And regardless of them being there, it shouldn't be using them since the dataType is json, not jsonp, right?

comment:5 Changed 12 years ago by jaubourg

These options are added because the options map you're getting within the callbacks is the fully constructed, internal, one (including the options provided to ajax AND the options in ajaxSettings).

And the json request gets promoted as a jsonp request because ajax allows stuff like:

    url: "...",
    dataType: "json",
    jsonp: "callbackParameter"

// OR

    url: "...",
    dataType: "json",
    jsonpCallback: "myCallbackName"

I could live without it, to be honest, but it made the transition from 1.4.x to 1.5.x for compatibility reasons.

comment:6 Changed 12 years ago by Rick Waldron

Component: unfiledajax

comment:7 Changed 12 years ago by Rick Waldron

Priority: undecidedlow
Status: newopen

comment:8 Changed 11 years ago by mikesherov

Milestone: 1.next1.6.4
Resolution: fixed
Status: openclosed

This appears to have been fixed as of 1.6.4: http://jsfiddle.net/fMt3t/80/

Note: See TracTickets for help on using tickets.