How to write routed link in javascript in asp.net c#

Last Reply 9 days ago By pratikshir

Posted 13 days ago

how  write URL Link in javascript insted of  

"url: "ESS/admin/OrderHistory.aspx/GetCustomers" this link is work

"url: "OrderHistory/GetCustomers" this link is not work for us 

 

In Global.asax

   static void RegisterRoutes(RouteCollection routes)
    {
 routes.MapPageRoute("OrderHistory", "OrderHistory", "~/Admin/OrderHistory.aspx");
}

 

function GetCustomers(pageIndex) {
            $.ajax({
                type: "POST",
                url: "OrderHistory/GetCustomers",
                data: '{searchTerm: "' + SearchTerm() + '", pageIndex: ' + pageIndex + '}',
                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: AnandM 13 days ago.
Posted 13 days ago
pratikshir says:
 $.ajax({
                type: "POST",
                url: "OrderHistory/GetCustomers",
                data: '{searchTerm: "' + SearchTerm() + '", pageIndex: ' + pageIndex + '}',
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: OnSuccess,
                failure: function (response) {
                    alert(response.d);
                },
                error: function (response) {
                    alert(response.d);
                }
            });

 replace above code with below.

$.ajax({
    type: "POST",
    url: '<%= Page.ResolveUrl("OrderHistory.aspx/GetCustomers")%>',
    data: '{searchTerm: "' + SearchTerm() + '", pageIndex: ' + pageIndex + '}',
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    success: OnSuccess,
    failure: function (response) {
        alert(response.d);
    },
    error: function (response) {
        alert(response.d);
    }
});

 

I agree, here is the link: https://www.e-iceblue.com/Introduce/spire-office-for-net-free.html