PHP8.1.21版本已发布
vue8.1.21版本已发布
jquery8.1.21版本已发布

jquery ajax后台返回list,前台用jquery遍历list的实现

高洛峰
高洛峰 原创
2016-12-08 13:52:34 1406浏览

如下所示:

   
$.ajax({ 
    type: 'post', 
    url: "maintain_findRoomByBuildingId.shtml", 
    cache: false, 
    data: {"buildingId":buildingId}, 
    dataType: 'json', 
    success: function(data){ 
      jQuery.each(data.roomList, function(i,item){ 
        alert(item.id+","+item.name); 
      }); 
    }, 
    error: function(){ 
      return; 
    } 
  });


声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。