【发布时间】:2021-04-05 06:08:37
【问题描述】:
我正在将自动完成系统添加到我正在开发的预订网站。我了解自动完成系统从预先填充的数据中获取。所以我正在尝试从 https://test.api.amadeus.com/v1/reference-data/locations 查看所有位置的列表,以便我可以设计自动完成系统,但我得到一个不好的响应,我的应用程序缺少一个重要参数。我正在尝试显示位置列表。 我希望有人能指出我哪里出错了。
"use_strict";
function getLocations(){
let url = "https://test.api.amadeus.com/v1/reference-data/locations";
fetch(url,{
method:"GET",
headers:{
"Content-Type":"application/json",
"Authorization":"Bearer BgRWNa48WGmqPowlRCMvIwHt6a96"
},
mode:"cors",
catch:"default"
}).then(function(response){
return response.json();
}).then(function(data){
console.log(data);
}).catch(function(error){
console.log(error);
});
}
getLocations();
**
:对象{状态:400,代码:32171,标题:“强制性数据丢失”, … }
**
【问题讨论】:
标签: javascript search fetch amadeus city