The google suggest thing uses xmlhttprequest to grab data from a remote source. http://www.joelonsoftware.com/items/2004/12/10.html has some info on it. (and links to a few sites that do a great job explaining it.)
I had done something similar with a hidden <iframe> as
outlined here. http://developer.apple.com/internet/webcontent/iframe.html
the basic idea of the iframe stuff is you load a webpage into the hidden iframe. The webpage is normally the result of a cgi that queries the data out of a database and writes
the results similar to below. (I used div's for simplicity
although anything you can browse via the DOM should work)
<div class=data>
<div id=item1></div>
<div id=item2></div>
</div>
THere is then javascript code that looks in the iframe and pulls the data out of the divs. That data is then used to do something.
the xmlhttprequest stuff seems like a much cleaner solution:
a) not have to use the krufty iframe foo
b) be able to use XML rather than html tags
I haven't spent a ton of time refining the IFRAME approach so there may be some things I'm missing. I'm also not very skilled with javascript so you may be able to work some magic that I'm unaware of.
|