我找不到任何关于使用 jQuery 获取 JSON 记录总数的信息。
下面是返回的 JSON:
{"电子邮件":"请输入您的电子邮件.","密码":"请输入密码."}``。
以下是我的代码:
$(function() {
$("#btnSubmit").click(function() {
$.ajax({
url: "/account/signup",
type: "POST",
dataType: "json",
data: {
Email: $("#strEmail").val(),
Password: $("#strPassword").val()
},
success: function(j) {
$(".errMsg").hide();
alert(j.length); // I couldn't get the total count
$.each(j, function(n) {
$("#err" + n).html(j[n]);
$("#err" + n).show();
})
},
error: function(req, status, error) {
alert(req);
}
});
});
});