Bug Tracker

Changes between Initial Version and Version 1 of Ticket #8084, comment 3


Ignore:
Timestamp:
Jan 28, 2011, 11:01:18 PM (11 years ago)
Author:
jitter
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #8084, comment 3

    initial v1  
    1 After some quick googling this [http://www.bennadel.com/blog/99-JSON-Minor-But-VERY-Important-Detail-Creating-Syntax-Error-Invalid-Label.htm blog post by Ben Nadel] came up. Where he describes an issues related to evaluating json, in short doing `eval( json )` and forgetting the parentheses instead of `eval( "(" + json ")" )`.
     1After some quick googling this [http://www.bennadel.com/blog/99-JSON-Minor-But-VERY-Important-Detail-Creating-Syntax-Error-Invalid-Label.htm blog post by Ben Nadel] came up. Where he describes an issues related to evaluating json, in short doing `eval( json )` and forgetting the parentheses, instead of `eval( "(" + json ")" )`.
    22
    33From this I made the following [http://jsfiddle.net/jitter/vghfT/ test case] which triggers this exception.
    44
    5 How can this be fixed? Either by setting `dataType: "json"` or by fixing the server to return the correct `Content-Type` for json responses which would be `application/json` instead of `application/javascript`.
     5How can this be fixed? Either by setting `dataType: "json"` or by fixing the server to return the correct `Content-Type` for json responses, which would be `application/json` instead of `application/javascript`.
    66
    77So I guess your problem has a similar cause. You propably didn't specify the  `dataType: "json"` option on the ajax call and the server doesn't respond with the correct `Content-Type` header.
    88
    9 What's still unclear to me is how what you have done worked in 1.4.4 and 1.5b1 but not in 1.5rc1, because afaik there wasn't a change which could have triggered this issue. The test case I gave above triggers the exception with all 3 versions of jQuery (1.4.4, 1.5b1, 1.5rc1).
     9What's still unclear to me is how what you have done worked, in 1.4.4 and 1.5b1 but not in 1.5rc1, because afaik there wasn't a change which could have triggered this issue. The test case I gave above triggers the exception with all 3 versions of jQuery (1.4.4, 1.5b1, 1.5rc1).
    1010
    11 Thus it would be interesting to see a test case or more information by the reporter detailing what exactly does to trigger this in 1.5rc1 but not in 1.4.4 or 1.5b1.
     11Thus it would be interesting to see a test case or more information by the reporter, detailing what exactly he does to trigger this in 1.5rc1 but not in 1.4.4 or 1.5b1.
    1212
    1313-----