var json={
"code": 0,
"msg": "",
"detailMsg": "",
"data": {
"list": [{
"date": "2017-09-14 17:34:31",
"price": 0.123311,
"volume": 0.1235,
"type": 0,
"rmb": 0.0152289085
},
{
"date": "2017-09-14 09:56:08",
"price": 5,
"volume": 1,
"type": 1,
"rmb": 5
},
{
"date": "2017-09-07 14:44:26",
"price": 0.071,
"volume": 1,
"type": 0,
"rmb": 0.071
}]
}
}
$.ajax({
url: '',
type: 'get',
}).then(function(data){
if (json.code==0) {
console.log('成功');
var html='';
var list=json.data.list;
$.each(list,function(i){
// console.log(list[i]);
var listi=list[i];
var date=listi.date;
var price=listi.price;
var volume=listi.volume;
var rmb=listi.rmb;
html+='<ul class="dabox"><li>'+date+'</li><li>'+price+'</li><li>'+volume+'</li><li>'+rmb+'</li></ul>';
});
$('.dabox').html(html);
};
},function(error){
});
简单ajax交互
最新推荐文章于 2018-08-14 12:33:47 发布