Bug Tracker

Opened 8 years ago

Closed 8 years ago

Last modified 7 years ago

#9000 closed bug (invalid)

parseerror in jquery-1.5.1.min.js

Reported by: marcelo.benzaquen@… Owned by: marcelo.benzaquen@…
Priority: low Milestone: 1.next
Component: ajax Version: 1.5.2
Keywords: Cc:
Blocked by: Blocking:

Description

When loading json with ajax, throws a parse error while the json format is completely valid and in jquery-1.4.2.min.js loads perfectly

Change History (9)

comment:1 Changed 8 years ago by addyosmani

Component: unfiledajax
Owner: set to marcelo.benzaquen@…
Priority: undecidedlow
Status: newpending

Thanks for taking the time to contribute to the jQuery project! Please provide a reduced test case on http://jsFiddle.net that reproduces the issue experienced to help us assess your ticket!

Additionally, test against the jQuery (edge) version to ensure the issue still exists.

comment:2 Changed 8 years ago by jaubourg

And ticket #9k is an ajax ticket! \o/

comment:3 Changed 8 years ago by anonymous

I also believe this is an error in version 1.5, 1.5.1 and 1.5.2. I receive parser errors. when running the same code in version 1.4.1 through 1.4.4. Everthing works fine.

NOTICE: I tested on the easiest web service call which returns a simple string. THE JQUERY REPORTS A PARSER ERROR.

SAMPLE CODE:

$(document).ready(function () {

djlHelloWorldRegiInitiate();

});

function djlHelloWorldRegiInitiate() {

$.ajax({

type: "POST", GET or POST or PUT or DELETE verb url: globalDjlScormWebServiceUrl4 + "getHelloWorld", data: "{}", contentType: "application/json; charset=utf-8", dataType: "json", success: djlHelloWorldRegiSuccess, error: djlHelloWorldRegiFailure

});

}

function djlHelloWorldRegiSuccess(data, status) {

alert("* helloWorld SUCCESS FROM REGI SERVICE:" + data.d);

}

function djlHelloWorldRegiFailure(request, status, error) {

alert("* helloWorld FAILURE FROM REGI SERVICE FAILED:" + request.statusText);

}

THANKS IN ADVANCE: DOUG LUBEY OF LOUISIANA

comment:4 Changed 8 years ago by Rick Waldron

Resolution: invalid
Status: pendingclosed

The problem is that you've set dataType to JSON. If you return a "simple" string and that "simple string" isn't valid JSON, boom: Parse Error.

comment:5 in reply to:  4 Changed 8 years ago by anonymous

i do return valid json data from the call...a simple string as json format...I have about 10 web services built on the same page(similar calls)....they all return json data. The entire page works with version 1.4.4.

but breaks with version 1.5 , 1.5.1 and 1.5.2 (i tried all 3).

The code i included is for 'sample' only. i will run more tests in the AM..but the only moving part at this time is the jquery version.

Replying to rwaldron:

The problem is that you've set dataType to JSON. If you return a "simple" string and that "simple string" isn't valid JSON, boom: Parse Error.

comment:6 in reply to:  4 Changed 8 years ago by anonymous

OK..so i have about 8 or 9 js files scripted @ the top of the code. So I isolated the web service calls into a separate file and only included the required external js files which are required to call the web services. Version 1.5.2 does work when in isolation. But still causes some type of conflict when ran with my other js files.

So when I determine which js file is causing conflicts with version 1.5.2 (but not version 1.4.4) I will post this file back. Most of these js files are shared/updated/supported in the same way jquery is.

Thanks and I will post back shortly.

Replying to rwaldron:

The problem is that you've set dataType to JSON. If you return a "simple" string and that "simple string" isn't valid JSON, boom: Parse Error.

comment:7 Changed 8 years ago by anonymous

And the file which conflicts with 1.5+ is: jquery.validate.pack.js

version: jQuery validation plug-in 1.7

specific version:

  • $Id: jquery.validate.js 6403 2009-06-17 14:27:16Z joern.zaefferer $

jquery.validate.pack.js was some how causing the conflict.

I am going to look around to see if a newer version of this code exists on the internet some where.

Doug Lubey of Louisiana

comment:8 Changed 8 years ago by anonymous

I found the fix (I had to also update the jquery.validate.min.js (to verison 1.8).

All my code works great again....

I downloaded the lastest version from his website: http://bassistance.de/jquery-plugins/jquery-plugin-validation/

He also has stated it was tested on all version 1.5+ frameworks.

Thanks for the allowing me to talk through the problem.

-doug

comment:9 Changed 8 years ago by Rick Waldron

Glad you were able to resolve this and thanks for posting the results here for others :D

Note: See TracTickets for help on using tickets.