数据未显示控制器使用JSON函数进行查看。我已经检查过使用断点控制器返回2的值,但数据没有显示在视图中,任何人都可以帮助我,我错了。
<script type="text/javascript">
$(function () {
debugger;
$.ajax({
type: "POST",
url: '@Url.Action("GetCustomer")',
data: '{}',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: OnSuccess,
failure: function (response) {
alert(response.d);
},
error: function (response) {
alert(response.d);
}
});
});
debugger;
function OnSuccess(response) {
var table = $("#dvCustomers table").eq(0).clone(true);
var customers = response.d;
$("#dvCustomers table").eq(0).remove();
$(customers).each(function () {
$(".MemberID", table).html(this.MemberShipID);
$(".name", table).html(this.name);
$(".FName", table).html(this.FName);
$(".Gender", table).html(this.Gender);
$(".address", table).html(this.address);
$(".phone1", table).html(this.phone1);
$(".mobileno", table).html(this.mobileno);
$(".email", table).html(this.email);
$("#dvCustomers").append(table).append("<br />");
table = $("#dvCustomers table").eq(0).clone(true);
});
}
</script>