62,614
社区成员
发帖
与我相关
我的任务
分享
success: function (data){
var status = data.status;
if(data.code=="0"){
alert(data.temp); //温度
alert(data.weather); //天气
alert(data.weatherimg); //图标
}else {
alert(data.status);
}
<span class="weather">
温度 天气 <img src="<%=path%>/images/index_images/logo02.png">图标
</span>
<script>
//ajax页面刷新
function changeDept() {
//var areaID = document.getElementById("areaId").value;
//var types = 'PERSONAL';
$.ajax({
type : "post",
dataType : "json",
//url : "${path}/businessguide/findOrgByDivisionCode.action?divisionCode="+ areaID,
success : function(data) {
//方法一:
var status = data.status;
if (data.code == "0") {
$(".weather").empty();
$(".weather").text("温度" + data.temp + "天气" + data.weather + "图标"+ data.weatherimg);
} else {
alert(data.status);
}
//方法二:
var html='';
var status = data.status;
if (data.code == "0") {
$(".weather").empty();
html+='"温度" + data.temp + "天气" + data.weather + "图标"+ data.weatherimg';
$(".weather").append(html);
} else {
alert(data.status);
}
}
});
}
</script>
<body>
<span class="weather"> </span>
</body>