【发布时间】:2014-03-10 10:00:29
【问题描述】:
我收到了错误
**POST http://localhost:34169/createNew.aspx.cs/Confirm 403 (Forbidden) **
当我尝试使用 Jquery AJAX 调用 CodeBehind 函数时。
我的代码:
function CallConfirmMethod(str) {
$.ajax(
{
type: "POST",
contentType: "application/json; charset=utf-8",
url: "createNew.aspx.cs/Confirm",
data: "{'smallPos': " + str + "}",
success: function (result) { alert("successful!"); }
});
}
还有 CodeBehind 功能(实际上并没有做任何事情,只是为了测试一下):
[System.Web.Services.WebMethod(BufferResponse = false)]
protected void Confirm(string str) {
// SKICKA SQL-QUERY
Response.Write("Funktionen kallas! " + str);
}
【问题讨论】:
-
你在用什么? IIS 还是 ASP.NET 开发服务器?
-
你试过 GET 而不是 POST 吗?