When you use ajax to fetch data, you can get it directly from data.foo. The lower version of jquery doesn’t work like before 1.4
$.post('/admin/UserBookView.do', {}, function(data) {
console.info(data);
});
Print the data information and display the string in json format, as follows:
{"acceptIs":null,"entity":null,"refuseIs":null,"result":{"pageSize":10,
"resultList":[{"PRICE":3,"WCTIME":null,"NOTE":" Integral anomaly ","CKTIME":null,"CUSER":"admin",
"CTIME":"2013/12/30 17:03:16","PHONE":"13111050937","ADDR":" Address of the test ","CUSERID":"1","SLTIME":null}],
"resultListArray":null,"titles":["ID","CTIME","STATE""PRICE","NOTE"],"totalPage":1,"totalSize":4},
"source":null,"storageIs":null,"treeNodes":null}
If type is not set, the default data returned is of type text
When we use data. To try to get the value inside, we return undefined
Here are two solutions:
One: use the eval function to convert a json string into a json object
var datas=eval("("+data+")");
Two: specify type
$.post('/admin/UserBookView.do', {}, function(data) {
console.info(data);
},"json");
Higher versions such as 1.8+ do not have this problem and return json objects