Javascript AngularJS Wordpress JSON API插件返回html而不是JSON
我试图从我的wordpress博客上获取最近的帖子,但它返回的是html而不是json。我想使用json使访问博客内容更容易。我已经安装并激活了插件。以下是我为获得帖子所做的:Javascript AngularJS Wordpress JSON API插件返回html而不是JSON,javascript,angularjs,wordpress,http-get,wordpress-json-api,Javascript,Angularjs,Wordpress,Http Get,Wordpress Json Api,我试图从我的wordpress博客上获取最近的帖子,但它返回的是html而不是json。我想使用json使访问博客内容更容易。我已经安装并激活了插件。以下是我为获得帖子所做的: $http.get('blog/?json=get_recent_posts') .success(function(data, status, headers, config){ $scope.post = data; console.log(data); }) .error(f
$http.get('blog/?json=get_recent_posts')
.success(function(data, status, headers, config){
$scope.post = data;
console.log(data);
})
.error(function(data, status, headers, config){-
console.log("unable to access!!!!!!!!!!!");
});
它返回html而不是json的原因是什么?有什么解决办法吗?其他一些帖子提到使用jsonp,但这对我也不起作用。我可能做错了,但当我在
http://www.example.com/
像这样:
http://www.example.com/index.php?rest_route=/my/rest/route/here
我最终得到了正确的回应
我花了很长时间才弄明白这一点,最后摸索出了一个返回给我的HTML格式的URL。我希望以http://www.example.com/wp_json/wp/v2/my/rest/route/here
,但我只收到了HTML响应