Ajax quick searches and lookups
September 21st, 2005 | Filed under Javascript, DHTML, AJAXObjectGraph’s define-as-you-type dictionary and Wikiwax’s dynamic Wikipedia lookup are my two favorite uses of Ajax.
A web programmer’s notebook.
ObjectGraph’s define-as-you-type dictionary and Wikiwax’s dynamic Wikipedia lookup are my two favorite uses of Ajax.
The free Ajax SuggestBox will render a search input box that drops down with suggestions as-you-type on a web page. The Javascript and server-side script for getting suggestions available for download.
The most useful applications of this type of suggest I’ve seen are for entering freeform tags in del.icio.us, and for a Wikipedia search at WikiWax. Of course, there’s always Google Suggest which I think started the whole suggest theme. Any others out there?
The CPAN for Javascript, JSAN seems to offer a whole lot of useful Javascript code for download. An interesting bit in the FAQ:
[The Javascript] people seem to fall into two camps. The first are people who consider themselves programmers or application developers. They like JSAN because it allows you to develop in an application style. Thinking about modular components is important in software design. The second group of people consider JavaScript a scripting language, something you write small things in.
I’ve tended toward the ’something that you write small things in,’ but then I saw Gmail and Google Maps, and I changed my mind.
Javascript logging using the fvlogger library looks SO MUCH BETTER than sprinkling alert()’s through your Javascript code.
Every time I have to publish a clickable email address on a web page I wind up Googling Javascript tools that obscure the mailto: link and telltale user@example.com format so that spam bots can’t easily pick up the address and tsunami the user with junk.
There are plenty of tools out there, but none that do all that I wanted: namely, encode the ‘mailto’ bit and display a live preview of the link. So I’ve gone ahead and thrown one together of my own.
Go ahead and give it a whirl, it’s got exciting iframe cross-scripting going on for the preview. *
* For now it’s Firefox-only while I work out the IE and Safari compatibility issues. Tested and works now on Internet Explorer 6 with SP 2 on Windows, Safari on Panther and Firefox Windows and Mac.
O’Reilly developer Micheal Smith asks readers what resources will help him learn Ajax, and gets a few good recommendations in response.
A quick way to see all the cookies a web page has currently set is to type the following into your browser’s address bar (works in all browsers):
javascript:alert(document.cookie);
CSS guru Eric Meyer’s Color Blender tool takes two colors and a number of midpoints and returns all the shades in between. I used the Color Blender to calculate the blues in this site’s design. Neat, helpful Javascript widget for the color-dumb.
Tim Taylor’s drag and drop sortable lists with Javascript and CSS could be a useful dynamic control on a web page. I use it in the not-yet released Scribblish for authors to reorder custom fields on the article edit page. It would also work well to reorder photos in a gallery app. Here’s a few examples of the drag and drop lists in action.