<script src= "jquery-1.2.1.pack. Web Effects" type= "text/Web Effects" ></script>
<script type= "Text/javascript" >
function Lookup (inputstring) {
if (Inputstring.length = = 0) {
Hide the suggestion box.
(' #suggestions '). Hide ();
} else {
. Post ("rpc.php", {querystring: "" +inputstring+ "}, function (data) {
if (Data.length >0) {
(' #suggestions '). Show ();
(' #autosuggestionslist '). HTML (data);
}
});
}
}//Lookup
function Fill (thisvalue) {
(' #inputstring '). Val (Thisvalue);
(' #suggestions '). Hide ();
}
</script>
jquery+php query MySQL to implement AutoComplete, write this tutorial, because most of the things you've seen about AutoComplete are just giving you a source code package, and then telling you how to use it, rather than telling you how it works and why. Knowing this will allow you to further customize the plugin to your own needs (I've written a lot about other apps in my blog about this).
Method Two
Json
$ (function () {
var text = $ (". Input"). Text ();
settimeout (function () {
if ($ (". Input"). Text ()!= text)
{
Text = $ (". Input"). Text ();
$.ajax ({
Type: "Get",
URL: "xxxx",//Put your PHP URL
Data:{text:text},//The data you accept in PHP is named text
DataType: "JSON",//Pass back time in JSON mode
Error:function ()
{
Alert ("Ajax load Failed");
},
Success:function (JSON)
{//json for returned data, do data binding here
var ottery = Json.data;
var $xiala = $ (' <div class= "Xiala><ul id=" datas "><li id=" Row "><li></ul></div>); ><li id= "Row" ><li> is a template for storing data
for (Var i=1;i<ottery.length;i++)
{
var row = $ ("#row"). Clone ();
Row.html (OTTERY[I].SSSJ);
ROW.ATTR ("id", "Ready");//change the ID of the row that binds the data
Row.appendto ("#datas");//Add to Template's container
}
$ ("#row"). Hide ();
$xiala. Appendto ("body");
})
}
},10);
})