【问题标题】:Passing entire html Table data to web method将整个 html 表数据传递给 web 方法
【发布时间】:2017-11-22 10:27:15
【问题描述】:

我有一个 Html 表格网格(多行),可在按钮单击(运行时)上动态生成行。我必须通过 jquery ajax 将整个 html 表数据传递给 web 方法。 附上快照以获取更多详细信息。 Form with asp.net controls and html table grid with multiples rows

【问题讨论】:

标签: javascript jquery html asp.net


【解决方案1】:

在这里您可以找到将表格转换为 json 的代码。 http://johndyer.name/html-table-to-json/

将表格转换为json后,使用下面的代码调用web方法。

jQuery.ajax({
    url: 'mypagewhichhavewebmethod.aspx/mywebmethod',
    type: "POST",
    data: "{'tablejsonData' : " + myjson + "}",
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    beforeSend: function () {
                  alert("Start!!! ");
               },
    success: function (data) {
                 alert("a");
              },
    failure: function (msg) { alert("errrrrr!!! "); }
    });

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多