怎样取JSON里的值?

{success:"true",data:{"obj.cacheId":1,"obj.cacheType":1,"obj.deviceName":"","obj.id":2880,"obj.pop":{"caches":[],"description":"昌平POP","domain":null,"domainId":1,"id":100024546,"isMonitor":1,"monitorTime":"","name":"昌平","oprStatus":1,"popIp":"","popMode":1,"priority":0,"protocolType":1,"runStatus":1},"obj.popId":0,"obj.priority":1}, msg:"",error:""}取obj.pop里name的值?

海绵宝宝撒
浏览 717回答 1
1回答

莫回无

javascript 获取jason值:var jsonData;$.ajax({type: "Get", //请求的方法url: "../public/dataaccess/rain/RainAreaMaxDataProvider.ashx?adomParameter=" +&nbsp;Math.floor(Math.random() * 1000 + 1), //要传递参数使用Ajax进行处理的类名称dataType: "text", //返回的数据类型global: false, //Ajax的范围async: false, //异步执行//成功情况下的处理success: function (strReult) {jsonData=eval("("+strReult+")");// var f= jsonData.AreaMax.data[0].AREA;}, //失败情况下的处理error: function () {alert("Ajax请求数据失败!");}});//循环读取for(var i=0;i<jsonData.AreaMax.data.length;i++){rainAreaMaxHtml+=jsonData.AreaMax.data[i].AREA+jsonData.AreaMax.data[i].STNM+jsonData.AreaMax.data[i].VAL;}
打开App,查看更多内容
随时随地看视频慕课网APP