曾经写了这么一段:
[code lang=”js”]
$(".sel_service").click(function(){
$.post("__URL__/showserverlist",{data:1},function(data){
$(".landing,.newserver").html(”);
$.each(data.data,function(index,val){
var url = "__URL__/windex/sid/"+val.server_id;
var href = val.classf == "a3" ? "javascript:;" : url;
var str = ‘<a class="’+val.classf+’" href="’+href+’" hidefocus="true">’+val.server_name+'</a>’;
$(".landing").append(str);
});
if(data.info){
$.each(data.info,function(index,val){
var url = "__URL__/windex/sid/"+val.server_id;
var href = val.classf == "a3" ? "javascript:;" : url;
var str = ‘<a class="’+val.classf+’" href="’+href+’" hidefocus="true">’+val.server_name+'</a>’;
$(".newserver").append(str);
});
}
if(data.status){
$.each(data.status,function(index,val){
var url = "__URL__/windex/sid/"+val.server_id;
var href = val.classf == "a3" ? "javascript:;" : url;
var str = ‘<a class="’+val.classf+’" href="’+href+’" hidefocus="true">’+val.server_name+'</a>’;
$(".allserver").append(str);
});
}
},"json");
});
[/code]
结果就出现了如下错误:
后来我把这3个each分开就好了!