【发布时间】:2010-09-15 20:21:11
【问题描述】:
这是我第一次尝试从 jQuery 调用 ASP.NET 页面方法。我在 responseText 消息中收到状态 500 错误,提示找不到 Web 方法。这是我的 jQuery $.ajax 调用:
function callCancelPlan(activePlanId, ntLogin) {
var paramList = '{"activePlanId":"' + activePlanId + '","ntLogin":"' + ntLogin + '"}';
$.ajax({
type: "POST",
url: "ArpWorkItem.aspx/CancelPlan",
data: paramList,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function() {
alert("success");
},
error: function(xml,textStatus,errorThrown) {
alert(xml.status + "||" + xml.responseText);
}
});
}
这是我试图调用的页面方法:
[WebMethod()]
private static void CancelPlan(int activePlanId, string ntLogin)
{
StrategyRetrievalPresenter presenter = new StrategyRetrievalPresenter();
presenter.CancelExistingPlan(offer, ntLogin);
}
我已经通过使用和不使用括号'()' 来装饰 Web 方法来尝试这个。有人有想法吗?
【问题讨论】: