Ajaxian Featured Tutorial: AutoCompleter 101
Jamie Mcconnell has taken the age old classic Ajax autocompleter, and has created a simple tutorial using jQuery and PHP. Jamie takes time to explain the “why” as much as the “how”:
-
-
<script src=“jquery-1.2.1.pack.js” type=“text/javascript”></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>
-
You can see it in action and download the source.
Read more on the source site
No comments yet.
feel free to leave a comment
Comment Guidelines: Basic XHTML is allowed (a href, strong, em, code). All line breaks and paragraphs are automatically generated. Off-topic or inappropriate comments will be edited or deleted. Email addresses will never be published. Keep it PG-13 people!
XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>
All fields marked with " * " are required.


