Ajax方法回调函数中遍历JSON数据类型问题

2024-11-26 12:41:02
推荐回答(1个)
回答1:

if (userid != null) {
jq.ajax({
"url" : "ShowShoppingCarServlet",
"type" : "post",
async : false,
"data" : "userid=" + userid,
"dataType" : "JSON",
"success" : function(data4) {
var car = "";
var str="";
for (var m = 0; m < data4.length; m++) {
car += "

  • 皮春¥"+ data4[m].price+ " X"+ data4[m].goodsnum + "
  • ";
    str+="
    "+data6[m].names+"颜色:灰哪握含色
    ¥"+data6[m].price+"26R删除 加入收藏";
    }
    jq("#cars").append(car);
    jq("#showcar").append(str);
    }
    });