我完全是新手,并学会了将我的旧式编码移至这些。现在我需要帮助。
我的 JSON(数组)-我的 php 结果json_encode
:
{"e_id":"12101","e_password":kkkk,"e_secretQuestion":null
{"e_id":"12102","e_password":kkkk,"e_secretQuestion":"abc"}
{"e_id":"12103","e_password":kkkk,"e_secretQuestion":"abc"}
我的jQuery:
e.preventDefault();
$.post("/general/helper.php?page=login",$(this).serialize(),function(data,status){
if (data != null){
var tblheader = "<table><tr>";
var tblbody= "";
$.each(data, function(i, field){
tblbody = tblbody + "<td style='border:1px solid gray'>" + field + "</td>";
});
tblbody = tblheader + tblbody + "</tr></table>";
$("#hasil").html(tblbody);
}
},"json");
问题:
如果仅返回 1 行,则其唯一格式为表格,但如果更多行表格未格式化...请帮助,如何简单地将其格式化为表格?此时,请不要建议我使用插件将 json 数组格式化为表格。
谢谢