success:function(data){
console.log(JSON.stringify(data));
var good_name = document.getElementById("goods_name");
var good_price = document.getElementById("goods_price");
var goods_market_price = document.getElementById("goods_market_price");
var goods_image = document.getElementById("goods_image");
good_name.innerHTML = data.data.name;
good_price.innerHTML = data.data.price;
goods_market_price.innerHTML = data.data.market_price;
console.log(getJsonObjLength(data.data.imagePath));
console.log(data.data.imagePath[0]);
var imgPT = getJsonObjLength(data.data.imagePath);//获取图片个数
for (var i = 0; i<(imgPT+2);i++) {
var imgs = document.createElement('div');
if(i == 0){
imgs.className = 'mui-slider-item mui-slider-item-duplicate';
imgs.innerHTML = '<a href="#"><img src="'+data.data.imagePath[(imgPT-1)]+'"></a>';
}else if(i == (imgPT+1)){
imgs.className = 'mui-slider-item mui-slider-item-duplicate';
imgs.innerHTML = '<a href="#"><img src="'+data.data.imagePath[0]+'"></a>';
}else{
imgs.className = 'mui-slider-item';
imgs.innerHTML = '<a href="#"><img src="'+data.data.imagePath[i-1]+'"></a>';
}
goods_image.appendChild(imgs);
}
}
这是返回代码我操作html的,还没完成,。。。新手求指导
如梦似幻 (作者)
谢谢亲
2017-01-18 18:01