Trying to implement an autocomplete box ultimately. For now im following php academy’s lead. I just want to echo out “suggestions go here” underneath the input area when anything is entered. I have to files. home.php and country.php. home contains the input part and country.php just prints the dummy suggestion text. Right now when I type in the input area ..nothing happens. I am using jquery v 1.6.2 (jquery-1.6.2.min.js)
home.php is:
<html>
<head>
<script type ="text/javascript" src ="jquery.js"></script>
<script type ="text/javascript">
function getSuggestions(value){
#.post("country.php", {countryPart:value}, function(data){
$("#suggestions").html(data);
});
}
</script>
</head>
<body>
<div id = "content_holder">
<input type = "text" name="country" value= "" id = "country" onkeyup="getSuggestions(this.value);" />
<div id ="suggestions"></div>
</div>
</body>
</html>
country.php is
<?php
echo "Suggestions Go Here";
?>
you wrote
should be
try that 🙂