ajax成功响应获取未定义的值

6uxekuva  于 2021-09-23  发布在  Java
关注(0)|答案(0)|浏览(206)

我从ajax成功响应参数中获得未定义的值。
这是我的密码,

function ShowProductDetail() {            
//Display Product
var AcNo = $("#txt_acno").val();
var MortgageNo = document.getElementById('<%= txt_mortgageNo.ClientID %>').value;
var Data = JSON.stringify({ mortgageNo: MortgageNo, acNo: AcNo });            
$.ajax({
        url: "CustomerMortgage.aspx/GetProductList",
        async: true,
        type: "POST",
        dataType: "json",
        data: Data,
        contentType: "application/json; charset=utf-8",
        success: OnSuccess,
        failure: function (response) {
            alert(response.d);
        },
        error: function (response) {
            alert(response.d);
        }
    });
}

function OnSuccess(response) {            
$('#<%= gv_productdetail.ClientID %>').DataTable(
{
    paging: false,
    destroy: true,
    bLengthChange: true,
    lengthMenu: [[5, 10, -1], [5, 10, "All"]],
    bFilter: true,
    bSort: true,
    bPaginate: true,
    data: response.d,
    columns: [{ 'data': 'ProductId' },
        { 'data': 'ProductType' },
        { 'data': 'Product' },
        { 'data': 'Pcs' },
        { 'data': 'GrossWeight' },
        { 'data': 'NetWeight' },
        { 'data': 'PurityWeight' },
        { 'data': 'Rate' },
        { 'data': 'ProductAmount' },
        { 'data': 'DesignImage' },
        { 'data': 'ProductRemarks' }]
    });      

alert(JSON.stringify(response.d.ProductAmount));

};

在警报中显示productamount的未定义值。而在datatable中,值是完美的。

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题