Here's a complete implementation of jQuery autocomplete for a normal input box with contents from a sharepoint list.
<script src="http://YOURSITEHERE/jquery.js"></script>
<script src="http://YOURSITEHERE/jquery-ui.js"></script>
<script type="text/javascript">
var SITE_URL = "http://YOURSITEHERE/";
var LIST_NAME = "MyList";
var listArray = [];
$( "<<id of your input control to autocomplete>>" ).autocomplete({
source: listArray
});
$(document).ready(function() {
var soapEnv =
"<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> \
<soapenv:Body> \
<GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
<listName>"+ LIST_NAME + "</listName> \
<viewFields> \
<ViewFields> \
<!-- Here is where you put the fields to retrieve -->
<FieldRef Name='Title' /> \
</ViewFields> \
</viewFields> \
</GetListItems> \
</soapenv:Body> \
</soapenv:Envelope>";
$.ajax({
url: SITE_URL + "/_vti_bin/lists.asmx",
type: "POST",
dataType: "xml",
data: soapEnv,
complete: processResult,
contentType: "text/xml; charset=\"utf-8\""
});
});
function processResult(xData, status) {
$(xData.responseXML).find("z\\:row").each(function() {
var listValues = $(this).attr("ows_Title");
listArray.push(listValues);
});
}
</script>