I have just updated to JQuery 1.5 and all my ajax calls that return JSON and a number of plugins instantly broke.
In my pre-1.5 code, I specified the dataType like:
dataType: "json"
Changing the dataType to:
dataType: "text json"
Fixes the problem but I do not want to manually change the plugins as this will affect upgrades.
Is there a way of handling this better with less disruption?
This problem is caused by the jQuery validation plugin and how it extends the ajaxSettings object for its own use (changes json calls to jsonp calls). There will hopefully be an official update to the validation plugin soon, but in the meantime, there's a patch available here that fixes the problem:
https://github.com/bigfix/jquery-validation/commit/9aa53f9241224ba349f9fe1b2c801be0f431b63b
Edit:
jQuery Validation Plugin, compatible with jQuery 1.5.1, available on git hub: https://github.com/jzaefferer/jquery-validation
Edit #2: jQuery Validation Plugin 1.8, compatible with jQuery 1.5.1 (and earlier) is released:
Read about it: http://bassistance.de/2011/03/25/release-validation-plugin-1-8/
Download it: http://bassistance.de/jquery-plugins/jquery-plugin-validation/
I came across this JQuery bug which fixes the problem http://bugs.jquery.com/ticket/8084.
Adding the following code after the JQuery script declaration fixes the problem:
$.ajaxSetup({ jsonp: null, jsonpCallback: null });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With