Skip to content

Instantly share code, notes, and snippets.

@ptahdunbar
Created September 25, 2015 00:59
Show Gist options
  • Save ptahdunbar/cdffa04c24347a36152d to your computer and use it in GitHub Desktop.
Save ptahdunbar/cdffa04c24347a36152d to your computer and use it in GitHub Desktop.
<html>
<head>
<script src="https://code.jquery.com/jquery-2.1.4.js" charset="utf-8"></script>
<script>
function showHint(str) {
jQuery.get("gethint.php?q=" + str, function(data){
document.querySelector('#txtHint').innerHTML = data;
});
return false;
}
</script>
</head>
<body>
<p><b>Start typing a name in the input field below:</b></p>
<form>
First name: <input type="text" onkeyup="showHint(this.value)">
</form>
<p>Suggestions: <span id="txtHint"></span></p>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment