Call WebMethod inside UserControl using jQuery Ajax in ASP.Net

Last Reply one year ago By dharmendr

Posted one year ago

it is possible we call static method in usercontrl (.ascx) like this

but it not work 

$.ajax({
    type: "POST",
    url: "sortinghtmltable.ascx/GetCustomers",
    data: JSON.stringify(obj),
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    success: OnSuccess,
    failure: function (response) {
        alert(response.d);
    },
    error: function (response) {
        alert(response.d);
    }
});

 

You are viewing reply posted by: dharmendr one year ago.
Posted one year ago

Hi SajidHussa,

You can't call static WebMethod in UserControl.

If you want the use WebService.

Refer below article.

Call (Consume) Web Service (ASMX) using jQuery AJAX in ASP.Net