list.data.length;
var list = JSON.parse(xhr.responseText);
java后台list列表数据:
<span style="white-space:pre"></span>List list = jzLdService.getListByJz(yxkssj, yxjssj, clhm, mtmc);
String json="{\"data\":" + JSONArray.fromObject(list) + "}";
return json;
返回格式:
{"data":[{"ID":50,"MTMC":"海珠区码头","CLHM":"粤A12","SJ":"2016-07-27"},{"ID":51,"MTMC":"海珠区码头","CLHM":"粤A12","SJ":"2016-07-27"}]}
前台js解析:
<pre name="code" class="javascript">list.data.length;
var list = JSON.parse(xhr.responseText);
数据获取:
list.data[i].ID;
list.data[i].CLHM;
list.data[i].MTMC;
...