Hi all,
In the page ClaimPortalPage.aspx I have a method like this
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public static string GetMyClaimsWithSearch(string caseManagerId, int selectedPage, int pageSize, string sortBy, string searchCondition)
{
Get data and return json type
}
I use dataModel as below but I can't call GetMyClaimsWithSearch method, it's always call Page_Load()
dataModel = {
location: "remote",
method: "POST",
getUrl: function () {
var data = '{ "caseManagerId":"' + caseManagerId + '"'
+ ', "selectedPage":"' + this.curPage + '"'
+ ', "pageSize":"' + this.rPP + '"'
+ ', "sortBy":"' + sortIndx + "-" + sortDir + '"'
+ ', "searchCondition":"' + claimSearchCondition + '"'
+ ' }';
var getObj = {
url: "/PortalPage/ClaimPortalPage.aspx/GetMyClaimsWithSearch",
data: data
};
return getObj;
},
getData: function (dataJSON) {
return { curPage: dataJSON.SelectedPage, totalRecords: dataJSON.TotalRecord, data: dataJSON.data };
}
};
My question is how to call GetMyClaimsWithSearch method like jquery ajax post?
$.ajax({
type: "POST",
url: "/PortalPage/ClaimPortalPage.aspx/GetMyClaimsWithSearch",
data: data,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: GetDataSuccess,
error: GetDataFail
});
And one more question, how to change Content-Type to "application/json; charset=utf-8"? Because I see the Content-Type of pqgrid when use method "POST" is "application/x-www-form-urlencoded; charset=UTF-8".