我试图通过调用方法在 jQuery 中通过 post 方法获取字符串。这是我的代码:
$("#btn_Submit").submit(function () {
$.ajax({
type: "POST",
url: "frm_GetTable.aspx/GetComment",
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
// Replace the div's content with the page method's return.
$("#Comment").empty().html(data);
}
});
这是我的功能:
protected String GetComment ()
{
String Comment="";
Comment=(" <table>");
foreach (DataRow dr in dt_Comment)
{
Comment +=("<tr ><td> </td><td rowspan='2'> " + dr["Com"].ToString() + " </td></tr>");
Comment += ("<tr><td >" + dr["Date"].ToString() + "</td></tr>");
}
Comment += ("</table>");
return Comment;
}
当我提交它显示Error :The state information is invalid for this page and might be corrupted
。请帮忙,我不明白问题出在哪里。