jQuery接受后台传递的List

后台代码:

@RequestMapping(params = "getUser")
@ResponseBody
public List<User>  getUser(){
List<User> list = new ArrayList<>();

return list;
}

前台代码:

$.ajax({
      type: "POST",
      url: "${pageContext.request.contextPath}/sys/user?getUser",
      success: function(data){
        jQuery.each(data, function (i, item) {
          alert(item.id);
        });
      }
    });

你可能感兴趣的:(javascript,前端)