Now it is time to take searching to the next level—the Web 2.0 level. By using Ajax, you can make searching a more interactive user experience. I will show you how to use Ajax to hint at possible search topics as the user is typing, a concept that was first made popular in the Google Suggest application. It is also important to handle search results correctly when displaying them to the user. You can place search results as the main content of the page, but having them displayed off to the side somewhere could also be useful.
We need to trap the
event, which, if you remember from Chapter 5, Internet Explorer handles
differently than all other Document Object Model (DOM)-compliant
browsers do. For this reason, it is easier to use Prototype's event
handling to trap the events. Consider the following XHTML
1 <form id="myForm" method="post" action="self"> 2 <div> 3 <input id="searchBox" name="searchBox" type="text" size="15" value="" /> 4 5 <input type="submit" onclick="return submitForm( );" /> 6 </div> 7 <div id="myHints"></div> 8 </form> 9 <div id="myResults"></div> ...