Ajax将数组发送到控制器而没有数据

时间:2016-08-25 16:05:37

标签: jquery ajax asp.net-mvc

我知道这个话题已经被提出了数百次,但我在任何有效的论坛都找不到任何解决方案:

var rows = $('#grid').jqxGrid('getrows');
var drtyRows = new Array();
for (var i = 0; i < rows.length; i++) {
    if (rows[i].nar1 != 0) {
        drtyRows.push(rows[i]);
    }
}                   
var jsoo = JSON.stringify(drtyRows );
alert(jsoo);  // shows data in jsoo correctly

$.ajax({
    type: "POST",
    cache: false,
    dataType: "json",
    url: "/Employee/Edit",
    contentType: "application/json",
    contentType: "application/json; charset=utf-8",
    traditional: true,
    async: false,
    data: jsoo,
    success: function (data) { alert("came back with Success"); },
    failure: function (errMsg) {
        alert(errMsg);
    }

});

Ajax将数组发送到控制器,但其中只有空行:

enter image description here

我在发送之前检查了发布的和stringifyed变量,看起来是正确的:

enter image description here

有什么想法吗?

0 个答案:

没有答案