Skip to main content

Bug Tracker

Side navigation

#8118 closed bug (invalid)

Opened February 01, 2011 11:55AM UTC

Closed February 02, 2011 08:24PM UTC

Last modified March 13, 2012 06:38PM UTC

ajax datatype json acts as jsonp for jquery 1.5

Reported by: gudski@gmail.com Owned by: gudski@gmail.com
Priority: low Milestone: 1.next
Component: ajax Version: 1.5
Keywords: Cc:
Blocked by: Blocking:
Description

used jquery.autocomplete which added $.ajax{dataType:"json"} which results in query adds jsonp callback and further the callback will cause a parse error, when removing the dataType spec. will cause correct behavior. In my scenario the response data structure is => [{"someproperty":"somevalue"}, {"someproperty":"somevalue"}]

Did a quick search for json in jquery-1.5.js and found this on row 6905:

// Detect, normalize options and install callbacks for jsonp requests
jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, dataIsString /* internal */ ) {

removing the "json" from first argument will add correct behavior when spec. dataType:"json"

Attachments (0)
Change History (5)

Changed February 01, 2011 12:00PM UTC by jitter comment:1

component: unfiledajax
description: used jquery.autocomplete which added $.ajax{dataType:"json"} which results in query adds jsonp callback and further the callback will cause a parse error, when removing the dataType spec. will cause correct behavior. In my scenario the response data structure is => [{"someproperty":"somevalue"}, {"someproperty":"somevalue"}] \ \ Did a quick search for json in jquery-1.5.js and found this on row 6905: \ \ // Detect, normalize options and install callbacks for jsonp requests \ jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, dataIsString /* internal */ ) { \ \ removing the "json" from first argument will add correct behavior when spec. dataType:"json"used jquery.autocomplete which added `$.ajax{dataType:"json"}` which results in query adds jsonp callback and further the callback will cause a parse error, when removing the `dataType` spec. will cause correct behavior. In my scenario the response data structure is => `[{"someproperty":"somevalue"}, {"someproperty":"somevalue"}]` \ \ Did a quick search for json in jquery-1.5.js and found this on row 6905: \ {{{ \ // Detect, normalize options and install callbacks for jsonp requests \ jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, dataIsString /* internal */ ) { \ }}} \ removing the "json" from first argument will add correct behavior when spec. `dataType:"json"`
priority: undecidedlow

Changed February 01, 2011 12:01PM UTC by jitter comment:2

owner: → gudski@gmail.com
status: newpending

Thanks for taking the time to contribute to the jQuery project by writing a bug report.

Please submit a reduced test case, which reproduces the issue you are experiencing, on http://jsfiddle.net. So that we can investigate this issue further.


How to report bugs

Changed February 02, 2011 02:17AM UTC by john.firebaugh comment:3

Are you using the jquery-validation plugin? It is not compatible with jQuery 1.5 and in particular causes the symptom you describe.

https://github.com/jzaefferer/jquery-validation/issues#issue/36

Changed February 02, 2011 10:31AM UTC by gudski@gmail.com comment:4

status: pendingnew

Yes, that is correct. I removed jquery-validation from loading and it makes things work. You can close this issue.

Thanks,

Daniel

Replying to [comment:3 john.firebaugh]:

Are you using the jquery-validation plugin? It is not compatible with jQuery 1.5 and in particular causes the symptom you describe. https://github.com/jzaefferer/jquery-validation/issues#issue/36

Changed February 02, 2011 08:24PM UTC by jaubourg comment:5

resolution: → invalid
status: newclosed