I’ve a jQuery dialog box, that contains html table. When I click OK button of the dialog, I need to pass this table to a method in code behind.
Here’s what I tried:
$("#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 is webmethod on code behind. But it’s not even called. Please help…
one of the issues is that you need to replace $(“#customTable”).val(); with $(“#customTable”).html(); and you can use the chrome inspector to see if there is a request going from your page to the server or not from the “Network” tab