後臺返回的數據 :前端
{"receiveList":[{"receive_dept_id":"1007873","receive_dept_desc":"區公司領導","guid":"2016112316042622494230","receive_platform_id":"001"},{"receive_dept_id":"1007876","receive_dept_desc":"主任","guid":"2016112316042626240391","receive_platform_id":"001"}]}
jquery
其實仔細分析返回的格式,很簡單,就是一個Map,裏面放了一個List,List裏面有各類參數。ajax
前端頁面的請求json
$.ajax({ui
url:"/moduleAuthen/default.do?method=loadAllReceive",url
dataType:"json", //返回的數據是json 格式orm
data:$("#fom1").serialize, //提交id爲form1的全部參數索引
success:function(data){io
var json =data.receiveList;function
//第一種方式的遍歷
for(var index in json){
//其實index 就是個索引
var guid =json[index].guid;
var receive_dept_desc =json[index].receive_dept_desc;
}
//還有一種jquery 方式的遍歷,效果實際上是同樣的,拿到後臺返回咱們的數據,咱們就能夠進行各類操做了。
$.each(json,index){
var guid =json[index].guid;
var receive_dept_desc =json[index].receive_dept_desc;
}
}
})