我想将for循环转换为.each()函数......这里是代码
for (var i in json_obj){
if(i > 0){
$("output").empty();
output += "<td>" + json_obj[i].id + "</td><td>" + json_obj[i].firstname + "</td><td>" + json_obj[i].lastname + "</td><td>" + json_obj[i].fullname + "</td><td>" + json_obj[i].email + "</td><td>" + json_obj[i].reg_data + "</td><br />";
output += ("<tr></tr>");
}
}
答案 0 :(得分:1)
我认为这就是你要找的东西:
$.each(json_obj, function(i, object){
if(i > 0) {
$("output").empty();
output += "<td>" + object.id + "</td><td>" + object.firstname + "</td><td>" + object.lastname + "</td><td>" + object.fullname + "</td><td>" + object.email + "</td><td>" + object.reg_data + "</td><br />";
output += ("<tr></tr>");
}
});