https://restapi.amap.com/v3/weather/weatherInfo
时间: 2023-08-09 08:11:17 浏览: 272
https://restapi.amap.com/v3/weather/weatherInfo是一个天气查询API服务的地址。你可以使用GET请求方式调用该API,并通过parameters参数传递其他参数。其中,city参数可以在提供的城市编码表中找到对应的取值。在你的项目中,你可以使用ajax来发送请求,例如通过以下代码查询北京市的天气:
```javascript
$.ajax({
type: 'get',
url: 'https://restapi.amap.com/v3/weather/weatherInfo?key=你的key&city=110000',
contentType: "application/json",
success: function (data) {
const {weather, temperature} = data.lives\[0\]
console.log(data)
}
})
```
这段代码使用了你提供的key和city参数来查询北京市的天气信息,并将结果打印在控制台上。你可以根据需要修改key和city参数来查询其他城市的天气信息。
#### 引用[.reference_title]
- *1* [Unity 接入高德开放API - 天气查询](https://blog.csdn.net/qq_42139931/article/details/121609952)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* *3* [高德地图API--天气查询](https://blog.csdn.net/qq_38475901/article/details/121018428)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文