JQuery autocomplete: is not working asp.net
- by Abu Hamzah
is that something wrong in the below code? its not firing at all
edit
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="HostPage.aspx.cs" Inherits="HostPage" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
<link rel="stylesheet" href="http://dev.jquery.com/view/trunk/plugins/autocomplete/jquery.autocomplete.css" type="text/css" />
<script type="text/javascript" src="http://dev.jquery.com/view/trunk/plugins/autocomplete/jquery.autocomplete.js"></script>
</head>
<body>
<form id="form1" runat="server">
<script type="text/javascript">
$(document).ready(function() {
$("#<%=txtHost.UniqueID %>").autocomplete("HostService.asmx/GetHosts", {
dataType: 'json'
, contentType: "application/json; charset=utf-8"
, parse: function(data) {
var rows = Array();
debugger
for (var i = 0; i < data.length; i++) {
rows[i] = { data: data[i], value: data[i].LName, result: data[i].LName };
}
return rows;
}
, formatItem: function(row, i, max) {
return data.LName + ", " + data.FName;
}
});
});
</script>
<div>
<asp:Label runat="server" ID='Label4' >Host Name:</asp:Label>
<asp:TextBox ID="txtHost" runat='server'></asp:TextBox>
<p>
</div>
</form>
</body>
</html>