我编写了以下代码将参数传递给服务器,并获得响应。
实际上,我的响应应该是要在网格上打印的报告。
调试代码时,调试器正在加载参数内部,但我不明白如何获取所需的报告数据。
如果我朝着正确的方向前进,也请建议我。
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;
//ValidateSearchUser();
//var str = "User name: " + userName + ", First name: " + firstName + "Last name: " + lastName + ", App. name: " + applicationName + ", Role: " + roleName + ", Location type: " + locationType + ", Location: " + location + ", User type: " + userType + ", Is Admin? " + isAdmin + "\nSearch functionality yet to be developed.";
//alert(str);
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 = {
//url: "postIt",
postData: dojo.toJson(searchUserParameters),
handleAs: "json",
headers: { "Content-Type": "application/json", "Accept": "application/json" },
load: function (data) {
//I am not understanding what code to write here.
},
error: function (error) {
alert("SVS error:" + error);
}
}
var deferred = dojo.xhrPost(xhrArgs);
return false;
}