0
這裏是我的代碼:
這段代碼是用來angularjs但是當我提交了信息錯誤「爲預檢響應具有無效的HTTP狀態代碼405」Foursquare API 405方法不允許?
$scope.listLocation = [];
$scope.getLocation = function() {
var time = Date.now();
return $http({
method: "POST",
url: 'https://api.foursquare.com/v2/venues/search?ll=11.5448729,104.8921668&client_id=.....&client_secret=......&v=1494294266811&limit=500&radius=500&intent=browse',
}).then(function success(res) {
$scope.listLocation = res.data.response.venues
}, function error(res) {
return res;
});
}
我試過方法GET也。它仍然是相同的 – Kristoff
它必須是除了方法和URL之外的東西。對我來說,下面的工作: '$捲曲-is 「https://api.foursquare.com/v2/venues/search?ll=11.5448729,104.8921668&client_id=LP5KESHULNRR3BCNKBD3O1J1FNMWQ3RFRHN34SSLV0GPMQLV&client_secret=ZI5233EL5L5LVJZIVHWKWSCBUCX0HIQ3MUJAXIEYVWQGOJTR&v=1494294266811&limit=500&radius=500&intent=browse」 | head -n1 HTTP/1.1 200 OK ' –
但是如果我試過通過POSTMAN測試它也可以,我不知道爲什麼 – Kristoff