jquery如何通过url读取josn内容并将指定层级的数据读出来
{"showapi_res_code":0,"showapi_res_error":"","showapi_res_body":{"data":[{"context":"...
{
"showapi_res_code": 0,
"showapi_res_error": "",
"showapi_res_body": {
"data": [
{
"context": "客户已签收",
"time": "2015-05-31 13:52:18"
},
{
"context": "离开 [广东_广州支公司_天河营业所_龙洞营业厅] 派送中",
"time": "2015-05-31 13:31:46"
},
{
"context": "到达 [广东_广州支公司_天河营业所_龙洞营业厅]",
"time": "2015-05-31 07:56:56"
},
{
"context": "已取件,到达 [广东_广州支公司_天河营业所_龙洞营业厅]",
"time": "2015-05-11 18:35:34"
}
],
"expSpellName": "zhaijisong",
"flag": true,
"mailNo": "3495769653",
"ret_code": 0,
"status": 4,
"update": 1437901505354
}
}
请教,jquery怎样把 "data"这一级的数据读出来?
$(document).ready(function() {
$.ajax({
type:"GET",
url:"josn远程链接",
dataType: "json",
success: function(data){
$.each(data,function(i,item){
var content=item.time+","+item.context+"</br>";
$("#result").append(content);
})
}
})
}); 展开
"showapi_res_code": 0,
"showapi_res_error": "",
"showapi_res_body": {
"data": [
{
"context": "客户已签收",
"time": "2015-05-31 13:52:18"
},
{
"context": "离开 [广东_广州支公司_天河营业所_龙洞营业厅] 派送中",
"time": "2015-05-31 13:31:46"
},
{
"context": "到达 [广东_广州支公司_天河营业所_龙洞营业厅]",
"time": "2015-05-31 07:56:56"
},
{
"context": "已取件,到达 [广东_广州支公司_天河营业所_龙洞营业厅]",
"time": "2015-05-11 18:35:34"
}
],
"expSpellName": "zhaijisong",
"flag": true,
"mailNo": "3495769653",
"ret_code": 0,
"status": 4,
"update": 1437901505354
}
}
请教,jquery怎样把 "data"这一级的数据读出来?
$(document).ready(function() {
$.ajax({
type:"GET",
url:"josn远程链接",
dataType: "json",
success: function(data){
$.each(data,function(i,item){
var content=item.time+","+item.context+"</br>";
$("#result").append(content);
})
}
})
}); 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询