在我的 MVC3 应用程序中,我使用 $.ajax 调用 JsonResult 类型的方法来获取要显示的数据:
function GetData(e) {
var ordersId = e.row.cells[0].innerHTML; //this is fine
$.ajax({
type: "POST",
url: "/Documents/GetDocumentData",
contentType: "application/json; charset=utf-8",
data: "{'id': '"+ordersId +"'}",
dataType: "json",
success: function (result) {
//load window
},
error: function (result) {
if (!result.success)
//show error
}
});
这是我的行动:
[HttpPost]
public JsonResult GetDocumentData(string id)
{
//my code
return Json(new { success = true});
}
当我在我的开发机器上调试时,它工作正常。我将它部署到我的测试网络服务器上,我得到'404 page not found dev/testwebsite/Documents/GetDocumentData' 如果出现问题,我应该在调试时得到这个,但我没有。为什么我会收到此错误?谢谢