Correct the following.
1. Missing Comma after minLength
2. Missing ending brackets of $(function ().
So, code would look like...
<script type="text/javascript" language="javascript">
$(function () {
$('#<%=txtItemCode.ClientID %>').autocomplete({
source: function (request, response) {
$.ajax({
url: "WebService.asmx/GetItemCode",
data: "{ 'ItemCode': '" + request.term + "' }",
type: "POST",
dataType: "json",
contentType: "application/json;charset=utf-8",
success: function (result) {
response(result.d);
},
error: function (result) {
alert('There is a problem processing your request');
}
});
},
minLength: 0, // Missing Comma
focus: function (event, ui) {
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
data: "{ Iid: '" + $('#<%=txtItemCode.ClientID %>').val() + "'}",
url: "WebService.asmx/GetNameFromService",
dataType: "json",
success: function (data) {
$('#<%=txtKeyWord.ClientID %>').val(data.d);
}
});
}
});
}); // Missing ending brackets of $(function ().
</script>