Dear Experts,
I have a question regarding the usage of ajax post call while using the MapPageRoute code in global.asax .
I'll show you some example that i have used.
In the Global.asax File Code looks like this.
protected void Application_Start(object sender, EventArgs e)
{
RouteTable.Routes.MapPageRoute("ICPDR", "InitialClaimReport", "~/Accounts/PC/Initial_Claim_Report.aspx");
}
And in the Js File Look like this.
$.ajax({
"dataType": 'json',
"contentType": "application/json; charset=utf-8",
"type": "POST",
"url": "InitialClaimReport/populate_User/",
"data": {},
"success":
function (json) {
$('#ddl_User').find('option').remove();
$("#ddl_User").append('<option value="0"></option>');
$.each(JSON.parse(json.d).list, function (key, val) {
$("#ddl_User").append('<option value="' + val.ID + '">' + val.User+ '</option>');
});
},
"error": function (xhr, status, p3, p4) {
var err = "Error " + " " + status + " " + p3 + " " + p4;
if (xhr.responseText && xhr.responseText[0] == "{")
err = JSON.parse(xhr.responseText).message;
alert(err);
}
});
And in the Code behind
[WebMethod(EnableSession = true)]
public static string populate_User()
{
try
{
BLL_Users objusr_BLL = new BLL_Users();
return objpractice_BLL.Fetch_UserList();
}
catch (Exception ex)
{
throw;
}
}
I have used the above code but My Ajax call is not woking.
Can you please help me to the use of the ajax call while using the routing in asp.net (Not MVC)
Thanks
Dileep..
What I have tried:
I have tried the above code and it is not working. please advise me what is wrong.
When i tried i got the error below...
POST http: