type: "post",//HostListInfo.java
url: encodeURI(encodeURI("pageHostList?iType=6&hostid="+rowData.HostId)),
cache:false,
success:function(data){
var jsonData=eval("("+data+")");
alert(jsonData[0].state);// 1. 单个取值
//2.取多值
//for(var key in jsonData)
//{//alert jsonData[key].GROUPNAME);
// }
}
});
1.取单值 String json="[{\"state\":\""+state+"\"}]";
查询固定一个字段
2. 去多值 while (rs.next()) {
jsonS += "{\"id\":\"" + rs.getString("id")
+ "\",\"text\":\"" + rs.getString("coloumName")
+ "\",\"state\":\"open\",";
jsonS += "\"children\":";
sonJson = this.queryTree(Integer.parseInt(rs.getString("id")),rightEdit);
jsonS += sonJson;
jsonS += "},";
id++;
}
if (id > 1) {
jsonS = jsonS.substring(0,jsonS.lastIndexOf(",")) + "]";
}
一般查询整表。loadrunner
原文链接:https://www.f2er.com/ajax/163616.html