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>