Defect #10761
closedRest API JSON response can not be parsed by jQuery
0%
Description
When I tried to get data via Rest API with json formatting,
I got an error message saying "Uncaught SyntaxError: Unexpected token :" with Chrome 18, jQuery 1.7.2.
Here is the javascript code :
$(function() { $.ajax({ type : 'GET', url : "http://www.redmine.org/trackers.json", success : function(data) { alert(data); }, dataType : 'jsonp' }); });
But the confusing thing is that the response of the API seems to be valid...
http://www.redmine.org/trackers.json
Then, I tired to call Wikipedia API in the same javascript code,
This was successfully done.
$(function() { $.ajax({ type : 'GET', url : "en.wikipedia.org/w/api.php?action=query&titles=redmine&prop=info&redirects=&format=json", success : function(data) { alert(data); }, dataType : 'jsonp' }); });
Related issues
Updated by Markus M over 12 years ago
First of all, does Redmine-REST-API support JSONP? (I found your issue with google because I was researching, if Redmine supports JSONP. I need JSONP)
It seems like JSONP is not supported. You can try it with this query for your issue: http://www.redmine.org/issues/10761.json?callback=dd
The response should be:
dd({{"issue":{"author":{"name":"Toshiya TSURU","id":2509},.....})
But it's still:
{{"issue":{"author":{"name":"Toshiya TSURU","id":2509},.....}
Updated by Jean-Philippe Lang over 12 years ago
- Status changed from New to Closed
- Resolution set to Duplicate
Updated by Jean-Philippe Lang over 12 years ago
JSONP support added in r10088 for 2.1.0.