Call WebMethod inside UserControl using jQuery Ajax in ASP.Net

Last Reply 21 days ago By dharmendr

Posted 21 days 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 21 days ago.
Posted 21 days 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