Loading

Monday, January 14, 2008

Connecting to Google for a Live Search

How can you connect to Google Suggest yourself? Say that you placed the search term you wanted to search for in a variable named term. You could then open this URL:

http://www.google.com/complete/search?hl=en&js=true&qu=” + term;

You get back a line of JavaScript from Google Suggest that calls a function named sendRPCDone. Here are the parameters passed to that function:

sendRPCDone(unusedVariable, searchTerm, arrayTerm, arrayResults, unusedArray)

What does the actual JavaScript you get back from Google Suggest look like?

If you’re searching for “ajax”, this is the JavaScript you’ll get back from Google as of this writing:

sendRPCDone(frameElement, “ajax”, new Array(“ajax”, “ajax amsterdam”,
“ajax fc”, “ajax ontario”, “ajax grips”, “ajax football club”, “ajax public
library”, “ajax football”, “ajax soccer”, “ajax pickering transit”), new
Array(“3,840,000 results”, “502,000 results”, “710,000 results”, “275,000
results”, “8,860 results”, “573,000 results”, “40,500 results”, “454,000
results”, “437,000 results”, “10,700 results”), new Array(“”));


You can handle this by putting together a function named sendRPCDone that will display this data

SHARE TWEET

Thank you for reading this article Connecting to Google for a Live Search With URL http://x-tutorials.blogspot.com/2008/01/connecting-to-google-for-live-search.html. Also a time to read the other articles.

0 comments:

Write your comment for this article Connecting to Google for a Live Search above!