Connecting to Google for a Live Search ~ Ajax Training, Learn Ajax Video Tutorials Online, Ajax Examples
Ajax Training, Learn Ajax Video Tutorials Online, Ajax Examples: Connecting to Google for a Live Search

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

Related Posts by Categories

5 comments:

Anonymous said...

What is Mashups in AJAX?

Anonymous said...

An Ajax mashup is a hybrid Web application. It uses Ajax techniques to present a rich UI that updates itself in place using content that it retrieves asynchronously from multiple sources. The server sends an initial page to the browser, which then makes calls to retrieve updated content. These calls can be made directly to the third-party sources from the browser or back to the originating server, which acts as a proxy for the third-party content.

Anonymous said...

What is the back ground work going on when you type www.google.com in your web browser?

Anonymous said...

actually there is nothing like yahoo.co.in it is actually an ip address which is resolved by DNS(domain name server ) so when you type google.co.in this is the work of DNS to identify the pertucular page and redirect you to that page

Anonymous said...

1. Browser gives a DNS request to the DNS server to resolve the name www.yahoo.co.in. The DNS request may be a TCP or UDP request to the DNS server.
2. After the IP address is recieved, the browser makes a socket connection with that IP Adress and port 80 ( if explicit port not given).
3. Now a Http GET request is fired by the browser on that socket connection and when the response starts coming it parses it and shows it on the screen.
4. Note depending on the content of the first response , multiple sockets might be open to retrieve embedded images and objects in the same page.

Useful Links on Adobe Flex

Your Ad Here

Latest Books on Adobe Flex