$.ajax({
url:'地址',
type:'POST', //get or post
data:{
userId: 1,
pageType: 'care',//规定字段
item:0,
},
dataType:'json',
success: function(data) {
var str = "";
for(var i=0,It=data.length;i<It;i++){//循环
str+='<div class="goods_box">< a href="'+data[i].item+'"><img src="'+data[i].photoUrl+'" class="googsImg" /><p class="goodsName">'
+data[i].contact+'</p></a></div>';
}
$(".goodsList").empty().append(str)//遍历在界面上
},
error:function(xhr,textStatus){
console.log('错误',xhr.responseText);
console.log(xhr);
console.log(textStatus);
}
})