Changes between Version 1 and Version 2 of Ticket #8084, comment 3
- Timestamp:
- Jan 29, 2011, 7:11:48 AM (11 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #8084, comment 3
v1 v2 1 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 ")" )`. 2 2 3 From this I made the following [http://jsfiddle.net/jitter/vghfT/ test case] which triggers this exception.3 From this I made the following [http://jsfiddle.net/jitter/vghfT/ test case] ~~which triggers this exception.~~ (not anymore as jsfiddle now returns the correct content type). You can this [http://jsfiddle.net/jitter/vghfT/3/ test case] which uses a little trick to simulate the behavior for a missing dataType statement and the server returning the wrong content type. 4 4 5 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`.