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: |
Description
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:2 Changed 12 years ago by
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
Cc: | jaubourg added |
---|
comment:4 Changed 12 years ago by
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
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:
$.ajax({ url: "...", dataType: "json", jsonp: "callbackParameter" }); // OR $.ajax({ 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
Component: | unfiled → ajax |
---|
comment:7 Changed 12 years ago by
Priority: | undecided → low |
---|---|
Status: | new → open |
comment:8 Changed 11 years ago by
Milestone: | 1.next → 1.6.4 |
---|---|
Resolution: | → fixed |
Status: | open → closed |
This appears to have been fixed as of 1.6.4: http://jsfiddle.net/fMt3t/80/
Deleting jsonp and jsonpCallback from the repeated request fixes it:
http://jsfiddle.net/fMt3t/10/
Likewise, setting jsonp and jsonCallback to null on the original request fixes it:
http://jsfiddle.net/fMt3t/11/
Lastly, using jQuery.ajaxSetup() to remove jsonp and jsonpCallback
http://jsfiddle.net/fMt3t/12/