ASP.NET、MVC、DOJO:请求错误:无法加载未定义的状态:404



我尝试使用Dojo从.ASPX页面调用ASP.NET MVC Action方法。但它显示了以下错误。。

请求错误:无法加载未定义的状态:404

我的代码如下:

function SearchUser() {
    var userName = document.getElementById("txtUserName").value;
    var firstName = document.getElementById("txtFirstName").value;
    var lastName = document.getElementById("txtLastName").value;
    var applicationName = document.getElementById("txtApplicationName").value;
    var roleName = document.getElementById("txtRoleName").value;
    var locationType = document.getElementById("txtLocationType").value;
    var location = document.getElementById("txtLocation").value;
    var userType = document.getElementById("txtUserType").value;
    var isAdmin = document.getElementById("chkAdmin").checked;
    var searchUserParameters = { "pageIndex": "1", "pageSize": "100", "userName": ""+ userName +"", "firstName":""+ firstName +"", "lastName":""+ lastName +"", "userType":""+ userType +"", "appName":""+ applicationName +"", "roleName":""+ roleName +"", "LocationType":""+ locationType +"", "location":""+ location +"", "isAdmin":""+ isAdmin +"" };
    var xhrArgs = {
        postData: dojo.toJson(searchUserParameters),
        handleAs: "text",
        headers: { "Content-Type": "application/json", "Accept": "application/json" },
        load: function (data) {
            document.getElementById("svsOutput").innerHTML = data;
        },
        error: function (error) {
            alert("Error occured:" + error);
        }
    }
    var deferred = dojo.xhrPost(xhrArgs);
    return false;
}

有人能告诉我出了什么问题吗?

您尚未指定要发布到的url。

var xhrArgs = {
    url: "path/to/service",
    ...
};

最新更新