请问以下代码script $documentreadyfunction var url = httpsgeoapiqweathercomv2citylookuplocation=fuling&adm=chongqing&key=1271def7ae8e49008a6f794eb30f2d87; $getJSONurl functiondata var cityId = data
可以将以下代码添加到上述代码中:
var fxLink = "https://www.weather.com.cn/weather/" + cityId + ".shtml";
$("#weather").wrap("<a href='" + fxLink + "' target='_blank'></a>");
这样就可以将获取到的天气信息绑定到一个链接上,方便在网站或应用中进行跳转。
原文地址: http://www.cveoy.top/t/topic/hv6e 著作权归作者所有。请勿转载和采集!