homepage Welcome to WebmasterWorld Guest from 54.234.2.88
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
Ajax auto suggestion search from database
xbl01234




msg:4385204
 10:04 am on Nov 9, 2011 (gmt 0)

I am implementing a Ajax auto suggestion search from database. I find an example from [roscripts.com ]. 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="" #nkeyup="autoSuggest##;" /><br />
<div id="update" st#le="display:none;position:relative;"></div>
<input type="image" name="register" class="submit-btn" src="http://www.roscripts.com/images/btn.gif" 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>

 

rocknbil




msg:4385319
 5:22 pm on Nov 9, 2011 (gmt 0)

I think something may be screwy in your editor, what are all the pound # signs? Verify that is not being placed in your page code.

Off the top, you may just have a simple error here (IGNORING the pound signs):


autocomplete="off" class="input" value="" #nkeyup="autoSuggest##;" />

That's supposed to be onkeyup, is it that way in your page?

xbl01234




msg:4385370
 9:47 pm on Nov 9, 2011 (gmt 0)

when i post my thread, this server edit my code, should not have the ##. i post it again

<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="http://www.roscripts.com/images/btn.gif" 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>

nelsonm




msg:4392923
 2:09 pm on Dec 1, 2011 (gmt 0)

Have you tried jQuery's autocomplete widget?

look here: [jqueryui.com...]

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved