JQuery AJAX post to asp.net webmethod never getting called

匆匆过客 提交于 2019-12-04 13:50:13

The method doesn't expect an array. Try like this:

var dataString = JSON.stringify({ 
    userId: userId, 
    type: type, 
    description: description, 
    amount: amount 
});

$.ajax({
    type: "POST",
    url: "register_borrower_step4.aspx/AddDebt",
    data: dataString,
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    success: function (result) {
        $(".pDebtsTable").text(result);
    }
});

Also make sure that floating point separator is correct according to the culture for the amount parameter. Make the distinction between . and , or the web method might not work. To further analyze any problems you could use FireBug to see exactly what is happening under the covers.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!