【发布时间】:2016-08-15 16:39:29
【问题描述】:
出于某些原因,我想从 jquery ajax 调用 ascx 页面中的 webmethod。
.ascx 页面
function StartProcessing() {
ShowProgress();
$.ajax({
type: "POST",
url: "ImportExcel.ascx/btnProcessing_Click",
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) {
alert('hi');
},
error: function (data) {
alert('error');
}
});
}
我在 ascx.cs 页面中的 webmethod:
[WebMethod]
public static void btnProcess_Click(object sender, EventArgs e)
{
//code which processes records in excel file
}
请提出一些方法来从 jquery ajax 调用 ascx 中的 webmethod
谢谢。
【问题讨论】:
标签: c# jquery ajax webmethod ascx