Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
611 views
in Technique[技术] by (71.8m points)

parse error - jQuery 1.5.1 breaks all ajax() calls

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

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 [email protected] 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 [email protected] 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.

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

and YES I am using jquery.validate.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...