dxt_9668
一锅小青蛙
2016-07-12 03:04

关于AJAX传json值到后台的问题

3

后台C#

 var s = '{"rows":[';
        var rows = $("#tt").datagrid("getRows");
        console.log("长度:"+rows.length);
        for (var i = 0; i < rows.length; i++) {
            s += '{"ID":"' + rows[i].id + '","name":"' + rows[i].name + '","number":"' + rows[i].number + '","date_single":"' + rows[i].date_single + '"},';
        }
        s += ']}';
                $.ajax({
            type: 'POST',
            url: "test_calendar.aspx/submit", 
            dataType: 'json',
            data:{jsonstring:s},
            contentType: "application/json; charset=utf-8",
            success: function (msg) {
                //msg是返回的结果,这里对返回值进行处理
            }
        });

后台怎么写?怎么接收?

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

7条回答