后台返回请求,处理数据,使用each循环数据
var delivery = { init: function(){ var com=$(".logistics-company").html(); var code=$(".logistics-id").html(); $.ajax({ url:"http://api.kuaidi100.com/api?id=cfbf7f7c6bf12197",data:{"com":com,"nu":code,"show":0,"muti":1,"order":desc},dataType:"json",type:"post",success:function(data){ var item; $.each(data,function(i,result){ item ='<li class=" special ">'+ '<span class="wl-stream-time">'+result['time']+'</span><span class="wl-stream-text">'+result['context']+'</span>'+ '</li>'; $(".wl-streamUL ul").append(item); } } }); } }原文链接:https://www.f2er.com/ajax/163384.html