Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Ajax auto suggestion search from database

Status
Not open for further replies.

dldl

Programmer
May 3, 2010
40
NZ
Hi;

I am implementing a Ajax auto suggestion search from database. I find an example from I have not problem with the php part about search from database, but i got a problem from the search from, i added a listerner to input tag, but it still not auto suggest anyword when i type any of word, Could any one help me, Thanks.

<html>
<head>
<title>roScripts - Ajax auto-suggest</title>

<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<script src="lib/prototype.js" type="text/javascript"></script>
<script src="src/scriptaculous.js" type="text/javascript"></script>
<script src="src/unittest.js" type="text/javascript"></script>

<script src="lib/builder.js" type="text/javascript"></script>
<script src="src/controls.js" type="text/javascript"></script>
<script src="src/effects.js" type="text/javascript"></script>

<link rel="stylesheet" href="css/style.css" type="text/css" />

</head>
<body>

<div id="container">

<form method="post" action="response.php">
<label for="testinput">Search</label><br />
<input type="text" id="search" name="search" autocomplete="off" class="input" value="" onkeyup="autoSuggest();" /><br />
<div id="update" style="display:none;position:relative;"></div>
<input type="image" name="register" class="submit-btn" src=" alt="submit" title="submit" />
</form>

<script type="text/javascript" language="javascript" charset="utf-8">

function autoSuggest(){
new Ajax.Autocompleter('search','update','response.php', { tokens: ','} );
Autocompleter.show();

}

</script>

</div>

</body>
</html>
 
Looking at there website in Chrome, Ff and IE i could not even get there demo page to auto suggest anything, So I assume their code no longer works in modern browsers, which seems to be the consensus in the comments on their page.

I'd say your best bet is to try and develop the ajax yourself.





----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Web & Tech
 
There are some errors in his code, but i have fixed the search size and it works for searching string from database now, but i still not figure out about the form and javascript part----do the auto suggestion thing, anywhere thanks:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top