What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » Ajax Help...

Ajax Help...
Author: Message:
lordy
Senior Member
****


Posts: 853
Reputation: 24
35 / Male / Flag
Joined: Jul 2004
Status: Away
O.P. Ajax Help...
Hey guys

I'm looking to do something similar to what facebook does when you search for a friend using their search box...

[Image: facebook.jpg]

OR... even better, something like what Google Suggest does

[Image: google.jpg]
*btw in this image, i had only typed "blah blah" into the search box and it popped up with all those options hehe :P


the difference being that i wouldn't want it to submit the form if the person was to key down and hit enter or click on the data that they wanted

What the idea is... that people will be adding data to a database/search data in a database, and when they are typing the first couple of letters of the Artist they are adding, it will search the database for artists that start with those few letters, and display those results and let them key down and select the right one if its there, saving them time typing the entire artist.

Anyway, i know how to retrieve the data, what i dont know is to code it in such a way that they can key down and have it replace the current input in the search/input box

I hope I'm making sense...

Anyway if anyone can point me in the right direction of how i could do that that would be great :D

Thanks!

lordy

This post was edited on 12-16-2007 at 10:30 AM by lordy.
12-16-2007 10:07 AM
Profile E-Mail PM Find Quote Report
lordy
Senior Member
****


Posts: 853
Reputation: 24
35 / Male / Flag
Joined: Jul 2004
Status: Away
O.P. RE: Ajax Help...
BTW I've had a look through the source code, particularly for Google, but I can't even see anything in the course code for the google page that looks like it would do that sort of thing :s so i got really confused lol
12-16-2007 08:53 PM
Profile E-Mail PM Find Quote Report
-dt-
Scripting Contest Winner
*****

Avatar
;o

Posts: 1819
Reputation: 74
36 / Male / Flag
Joined: Mar 2004
RE: Ajax Help...
the basic idea behind it is

you add an event listener to the testbox ( on the keypress event)
in that callback you use xmlhttprequest to pull the data from the server and then you display it in a div under the textbox :)

theres quite a few premade scripts of this already :)

if you want to use jquery theres a plugin to do this :)

download jquery
download jquery.suggest

then add this to your page (assuming the search box id is suggest)

code:
$(function($){

$("#suggest").suggest("files/search.php",{
onSelect: function() {alert("You selected: " + this.value)}});

}

[Image: dt2.0v2.png]      Happy Birthday, WDZ
12-16-2007 10:07 PM
Profile PM Web Find Quote Report
lordy
Senior Member
****


Posts: 853
Reputation: 24
35 / Male / Flag
Joined: Jul 2004
Status: Away
O.P. RE: Ajax Help...
quote:
Originally posted by -dt-
the basic idea behind it is

you add an event listener to the testbox ( on the keypress event)
in that callback you use xmlhttprequest to pull the data from the server and then you display it in a div under the textbox :)
I can get that part fine, it's more the arrow-navigation of the results that I can't get :(
12-17-2007 08:33 AM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On