7

jQuery 1.5.1(または1.5)にアップグレードするとajax()、サイト内のすべての呼び出しでエラーオプション関数に「parserror」が生成されます。スクリプトエラーもあります

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

サイトは1.4.4を使用してエラーなしで実行されています。これは、ajax()呼び出しの1つからのコードです。

$.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.'
      );
  }
});

多くの調査の結果、エラーが発生している理由がわかりません。どんな洞察もありがたいです。

編集済み:jQueryのフルバージョンでは、次のようになります。

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を使用しています。

4

2 に答える 2

8

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.

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

于 2011-03-11T18:39:58.417 に答える
4

http://bugs.jquery.com/ticket/8302を参照

dataType: 'text json'そしてあなたのコードで試してください

于 2011-03-27T08:27:08.590 に答える