The example of this article for you to share jquery access to the current city weather information code for your reference, the specific contents are as follows
HTML Code:
<div id= "Weather" ></div>
Jquery Code:
function Findweather () {var cityurl = ' http://int.dpool.sina.com.cn/iplookup/iplookup.php?
Format=js '; $.getscript (Cityurl, function (script, textstatus, jqxhr) {var citytq = remote_ip_info.city;//get city var url = "HT
Tp://php.weather.sina.com.cn/iframe/index/w_cl.php?code=js&city= "+ citytq +" &day=0&dfc=3 ";
$.ajax ({url:url, DataType: "Script", Scriptcharset: "GBK", success:function (data) { var _w = window.
SWTHER.W[CITYTQ][0];
var _f= _w.f1+ "_0.png";
if (new Date (). GetHours () >) {_f= _w.f2+ "_1.png"; var img = " ";
var TQ = citytq + "" + img + "" + _w.s1 + "" + _w.t1 + "℃~" + _w.t2 + "℃" + _w.d1 + _w.p1 + "class";
$ (' #weather '). HTML (TQ);
}
});
}); } findweather ();
The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.