0

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

$("#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 是背后代码的 webmethod。但它甚至没有被调用。请帮忙...

4

1 回答 1

1

问题之一是您需要替换 $("#customTable").val(); 与 $("#customTable").html(); 您可以使用 chrome 检查器查看是否有从您的页面到服务器的请求,或者是否来自“网络”选项卡

于 2012-10-04T10:36:47.150 回答