Shanmugaraja_K
Shanmugaraja_K

Reputation: 2382

AJAX call not working in ASP.net

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

Answers (1)

user7449966
user7449966

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

Related Questions