jQuery 1.5和新的“文本JSON"数据类型 [英] JQuery 1.5 and new "Text JSON" datatype

查看:80
本文介绍了jQuery 1.5和新的“文本JSON"数据类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚更新到JQuery 1.5,我所有返回JSON的ajax调用都立即中断了.

I have just updated to JQuery 1.5 and all my ajax calls that return JSON and a number of plugins instantly broke.

在我的1.5之前的代码中,我指定了dataType,例如:

In my pre-1.5 code, I specified the dataType like:

dataType: "json"

将dataType更改为:

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?

推荐答案

此问题是由jQuery验证插件以及它如何扩展ajaxSettings对象供自己使用(将json调用更改为jsonp调用)引起的.希望很快将对验证插件进行正式更新,但是与此同时,这里有一个可用的补丁程序可以解决该问题:

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/9aa53f9241224ba349f9fe1b2b801b0f431 /a>

https://github.com/bigfix/jquery-validation/commit/9aa53f9241224ba349f9fe1b2c801be0f431b63b

修改:

jQuery验证插件,与jQuery 1.5.1兼容,可在git hub上获得: https://github.com/jzaefferer/jquery-validation

jQuery Validation Plugin, compatible with jQuery 1.5.1, available on git hub: https://github.com/jzaefferer/jquery-validation

编辑#2 : 已发布与jQuery 1.5.1(及更早版本)兼容的jQuery Validation Plugin 1.8:

Edit #2: jQuery Validation Plugin 1.8, compatible with jQuery 1.5.1 (and earlier) is released:

了解以下内容: http://bassistance.de/2011/03/25/release-validation-plugin-1-8/

下载它: http://bassistance.de/jquery-plugins/jquery-插件验证/

这篇关于jQuery 1.5和新的“文本JSON"数据类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆