EntropySink

Technical & Scientific => Programming => Topic started by: Perspective on March 13, 2008, 05:33:52 PM

Title: AJAX/JS Code Resources
Post by: Perspective on March 13, 2008, 05:33:52 PM
I'm looking for some frameworks or code snippit repositories with some common AJAX/JS stuff to avoid reinventing the wheel.

My first target is a "suggest" style text box that can auto-complete (via highlighted completions like open office) or suggest (via a list box like "google suggest (http://www.google.com/webhp?complete=1&hl=en)").

The number of possible completions could be huge (say, 10s of millions) so I'm not sure how this should be done (Ship the whole list client side on the initial page load then just use a trie or prefix hash index OR AJAX request for some prefix after the first few letters are typed... too slow?).

Any suggestions (for resources or for the problem described above)?
Title: Re: AJAX/JS Code Resources
Post by: hans on March 13, 2008, 08:55:24 PM
I've found this site useful:
http://www.dhtmlgoodies.com/
Title: Re: AJAX/JS Code Resources
Post by: Perspective on March 13, 2008, 10:21:43 PM
nice!

http://www.dhtmlgoodies.com/packages/dhtml-suite-for-applications/demos/demo-auto-complete.html

Thanks. I haven't looked at the code yet, but from the demo it looks like they wait for the first key press, then retrieve then index for that key. Seems to be pretty responsive (of course that depends on the server and client connection) and the list of cities has to be decently sized. This should be a great starting point.
Title: Re: AJAX/JS Code Resources
Post by: Perspective on March 14, 2008, 10:50:09 AM
well after looking at the code, the list of cities in the demo is small and sent direct to the page all at once. It pauses to load because of a linear scan. Anyway, I think I should be able to use AJAX to request smaller files after key presses.
Title: Re: AJAX/JS Code Resources
Post by: hans on March 14, 2008, 12:48:23 PM
For some reason I seem to recalling seeing that Google made their API available for the "suggest" feature but I'm having trouble finding the page right now.
Title: Re: AJAX/JS Code Resources
Post by: Canuck on March 15, 2008, 01:58:59 AM
Oooh, I was looking for something like that for the website Im working on.. I have to test it out with my data to see how long it will take to load.

Also going to use the calendar scrip on there to populate a form.
Title: Re: AJAX/JS Code Resources
Post by: ober on March 15, 2008, 08:11:43 AM
http://www.phpfreaks.com/forums/index.php/topic,79168.0.html

Might help.