【发布时间】:2016-08-02 05:54:42
【问题描述】:
服务
some.factory('homeService', ['$http', function($http){
return {
getEvents : function(url) {
return $http.jsonp(url);
}
}
}]);
控制器
homeService.getEvents("http://server.some.io/s/first?callback=JSON_CALLBACK")
.then(
function(response){
$scope.events = response.data.events;
});
错误:未捕获的 SyntaxError:意外令牌 :
即:json对象:{"meta": {"has_next": false, "status": 200, "place":.....
错误指向“元”之后
有什么线索吗?
【问题讨论】:
-
当然。您的“JSON”响应不是“JSONP”响应。你不能用javascript解决这个问题。
server.some.io似乎不支持 JSONP。 -
是的。它正在返回常规 json