Reputation: 2382
I have problem while using AJAX in ASP.Net.getName not fired.. anything wrong.? Please find the below samples and suggest me.
` <input type="button" value="Bulk Save" id="savebtn" />`
$("#savebtn").click(function () {
var firstName = "SAmple";
var lastName = "Name";
var param = { fs: firstName, ls: lastName };
$.ajax({
type: "POST",
url: '<%=ResolveUrl("~/Features.aspx/getName")%>',
data:JSON.stringify(param),
contentType: "application/json; charset=utf-8",
dataType: "json",
//async:true
})
});
[WebMethod]
public static void getName(string fs, string ls)
{
}
Upvotes: 1
Views: 1464
Reputation:
if you are using a separate js file for your ajax code, then you can use this
url:'http://domain_name/controller_name/method'
otherwise
url: "Features.aspx/getName"
Upvotes: 1