jQuery对话框 - 将表返回给代码隐藏方法

时间:2012-10-04 10:31:38

标签: jquery asp.net jquery-ui

我有一个jQuery对话框,其中包含html表。当我单击对话框的OK按钮时,我需要将此表传递给后面的代码中的方法。 这是我试过的:

$("#custom-modal").dialog({
            height: 200,
            modal: true,
            buttons: { "OK": function () {
                var table1 = $("#customTable").val();
                $.ajax({
                    type: "POST",
                    url: "MyPage.aspx/BindCustom",
                    data: ({ param1: table1 }),
                    error: function (XMLHttpRequest, textStatus, errorThrown) {
                        alert(textStatus);
                    },
                    success: function (result) {
                        alert("success");
                    }
                });

                $(this).dialog("close");
                return true;
            }, "Cancel": function () {
                $(this).dialog("close");
                return false;
            }
            }

        });

BindCustom是关于代码背后的web方法。但它甚至没有被召唤。请帮忙......

1 个答案:

答案 0 :(得分:1)

其中一个问题是你需要替换$(“#customTable”)。val(); with $(“#customTable”)。html();并且您可以使用chrome检查器查看是否有从页面到服务器的请求从“网络”选项卡

相关问题