How can I call a ASP.Net webservice using AJAX without calling controller

49 Views Asked by At

I want to call webservice directly without calling controller action method. Is this possible, and if so how? My current code does not do this.

$(document).ready(function () {
    $("#txtsearch").autocomplete({
        source: function (request, response) {
            $.ajax({
                type: "POST",
                contentType: "application/json; charset=utf-8",
                url: "WebServiceSearch.asmx/GetData",
                data: "{'DName':'" + document.getElementById('txtsearch').value + "'}",
                dataType: "json",
                success: function (data) {
                    response(data.d);
                },
                error: function (result) {
                    alert("Error......");
                }
            });
        }
    });
});
0

There are 0 best solutions below