在线咨询
微信咨询
服务热线
服务热线:15639912513
TOP
当前位置:
首页 > 新闻中心> 前端设计>ajax中each遍历的使用方法

ajax中each遍历的使用方法

发布时间:2022-03-31 浏览:4369次

郑州商城网站开发商城的时候,遇到ajax中each遍历的使用方法。

下面是全部代码:

$.ajax({

type:"POST",

url:"http://www.xhhkj.cn",

data:{category_id:category_id,goods_name:goods_name},

dataType:"json",

success:function(data){

$.each(data,function (index) {

options+="<option >"+data[index].goods_name+"</option>";

    });

$("#goods_id").html(options);

 

}

});

其中

$.each(data,function (index) {

options+="<option >"+data[index].goods_name+"</option>";

});

这段代码就是遍历ajax获取data的方法。


TAG
4369
该内容对我有帮助