NutzCN Logo
问答 返回的list集合带门....
发布于 1828天前 作者 读书人 1495 次浏览 复制 上一个帖子 下一个帖子
标签:
function load_list() {
	$.ajax({
		url:"${pageContext.request.contextPath }/restaurant/getDituList",
		type:"POST",
		data:{
			"AppId":null
			},
		error: function(request) {
	       alert("Connection error");
	   },
	   dataType:"json",
	   success:function(res){
		   PackagData(res);
	   }
	});
 
	}
   @At
    @Filters(@By(type = CrossOriginFilter.class))
    public Object getDituList(@Param("AppId") String AppId,@Param("orgid") String orgid){
	
    	List<Restaurant> list=reDao.getDituList(AppId, orgid);
		int count=reDao.getDituListCount(AppId, orgid);
		Map<String,Object> res=new HashMap<String, Object>();
		res.put("Rows", list);
		res.put("pages", count);
		return res;
		
	}
   

打断点看list 有值但是上面有一个门的图标,页面alert undefined......

5 回复

没看到alert语句

function PackagData(res){
		creatmap();
		$.each(res,function(i,obj){
			
			alert(obj.restaurantId);
			
			if(obj.longitude!=null){
			var marker;
			marker = new AMap.Marker({
				position:[obj.longitude,obj.latitude] ,
				map: map
			});
		
		markers.push(marker);
		
		//实例化信息窗体
	    var title = obj.restaurantName,
	        content = [];
	    
	    if(obj.restaurantName==null||obj.restaurantName==""){
	    	//不拼接
	    }else{
	    	content.push("<a id=\"chaolianaa\" target=\"_blank\" href=\"#\">"+obj.restaurantName+"</a>");
	    }
	    var infoWindow = new AMap.InfoWindow({
	        isCustom: true,  //使用自定义窗体
	        content: createInfoWindow(title, content.join("<br/>")),
	        offset: new AMap.Pixel(16, -45)
	    });
		
		var _onClick = function(e){
			
			toshipin(obj.restaurantId,obj.restaurantName);
			//自定义窗体 
			//infoWindow.open(map, marker.getPosition());
		};
		AMap.event.addListener(marker, 'click', _onClick);
			 map.setFitView();
			 
			}else{
				
			}
			
			
			
			});
		
}

后面断点看list 是一个门的图标后面是(0...99)

console.log(res)

{pages: 102, Rows: Array(102)}

大哥,我找到问题了,后面封的rows,前面遍历的是 res,。。。 就是不知道鼠标放到list为啥有一个门的标志。。。

添加回复
请先登陆
回到顶部