jQuery 1.5.1中断了所有ajax()调用 [英] jQuery 1.5.1 breaks all ajax() calls

查看:96
本文介绍了jQuery 1.5.1中断了所有ajax()调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我升级到jQuery 1.5.1(或1.5)时,我站点中的所有ajax()调用都会在错误选项功能中产生"parserror".还有一个脚本错误

When I upgrade to jQuery 1.5.1 (or 1.5) all of the ajax() calls in my site produce a "parserror" in the error option function. There is also a script error

Uncaught SyntaxError: Unexpected token : jquery-1.5.1.min.js:16

该网站使用1.4.4运行时未出现错误.这是来自ajax()调用之一的代码.

The site has been running w/o errors using 1.4.4. Here is code from one of the ajax() calls.

$.ajax({
  url: '/CustomerGroup/Get',
  type: 'POST',
  contentType: 'application/json; charset=utf-8',
  dataType: 'json',
  success: function (grp) {
    if (grp != null) {
      clear();
      group = grp;
      load(grp);
    } else{
        showError(
                    'Customer Group',
                    'Whoops, error getting customer group information. Please contact support@myorg.com and include your username and date/time of the error.'
                    );
            }
  },
  error: function (x,s,e) {
    showError(
      'Customer Group',
      'Whoops, error getting customer group information. Please contact support@myorg.com and include your username and date/time of the error.'
      );
  }
});

经过大量研究,我无法弄清楚为什么会发生错误.任何见解都表示赞赏.

After much research I can not figure out why the error is occurring. Any insights appreciated.

使用完整版的jQu​​ery,我得到以下信息:

EDITED: With the full version of jQuery I get the following:

Uncaught SyntaxError: Unexpected token :
d.d.extend.globalEvaljquery-1.5.1.js:16
d.ajaxSetup.converters.text scriptjquery-1.5.1.js:16
bJjquery-1.5.1.js:16
wjquery-1.5.1.js:16
d.support.ajax.d.ajaxTransport.send.cjquery-1.5.1.js:16

是的,我正在使用jquery.validate.

and YES I am using jquery.validate.

推荐答案

这是

This is a bug in the jQuery validation plugin. I hit the exact same problem two days ago. As it says on the jQuery validation plugin site, version 1.7 is not compatible with jQuery 1.5.x.

您需要从Jörn的github页面安装新版本的validate .

You need to install the newer version of validate from Jörn's github page.

这篇关于jQuery 1.5.1中断了所有ajax()调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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