[Solved] jQuery AutoComplete ASP.Net TextBox not working in Hosted Server

micah
 
on May 05, 2021 04:58 AM
1496 Views

this auto complete works on local machine but not working on web hosted site.url: "Placeorder.aspx/GetEmpNames", 

     <script src="js/main.js"></script>
     <script type="text/javascript">    
        $(function () {    
            $("#txtEmpName").autocomplete({    
                source: function (request, response) {    
                    var param = { empName: $('#txtEmpName').val() };    
                    $.ajax({    
                        url: "Placeorder.aspx/GetEmpNames",    
                        data: JSON.stringify(param),    
                        dataType: "json",    
                        type: "POST",    
                        contentType: "application/json; charset=utf-8",    
                        dataFilter: function (data) { return data; },    
                        success: function (data) {    
                            response($.map(data.d, function (item) {    
                                return {    
                                    value: item    
                                }    
                            }))    
                        },    
                        error: function (XMLHttpRequest, textStatus, errorThrown) {    
                            var err = eval("(" + XMLHttpRequest.responseText + ")");    
                            alert(err.Message)    
                           // console.log("Ajax Error!");    
                        }    
                    });    
                },    
                minLength: 2 //This is the Char length of inputTextBox    
            });    
        });    
    </script> 

 

Download FREE API for Word, Excel and PDF in ASP.Net: Download
dharmendr
 
on May 05, 2021 05:00 AM

Hi micah,

Make sure you have copied the latest compiled bin folder in your hosted server.