The Google suggest of Ajax case studies

Source: Internet
Author: User
Tags interface
Ajax|google

Google suggest

Google has a Google suggest website. When people enter the search text box to query the keyword, Google will automatically give some keyword suggestions. From the content, it is actually the same as Baidu's related search. However, in the interface is very different, Baidu related search when listed below the search results page.

Google's relevant search recommendations are real time display in the input text box, with the input of different prompts are also different. Displays only 10, along with the number of search results for these keywords.

The difference between the interface and the use behavior. In Baidu, people must first look for a, and then to see the relevant keywords, this site itself can increase the number of visits, but for users is cumbersome things. Google's suggest is different and has been advised before searching. On the help page for this feature, Google points out that the keywords are not based on the local history of the browser, but on the processing of statistical results that people search for.

Ajax implementation Google suggest

Google suggest than Gmail to deal with more, on a page a script file, the code is clear, in the tone when the connection was broken, and finally found an agent to tune through the code. Google suggest that can be run locally

Please download in this connection: Http://www.blogjava.net/Files/emu/suggest.rar

One of the script files Ac.js has done a bit of collation, the key QC function crack a bit, so that it can find the server:

FUNCTIONQC (AC) {

if (l&&l.readystate!=0) {

L.abort ()

}

L=VB ();

if (l) {

L.open ("Get", "http://www.google.com" +aa+ "&js=true&qu=" +ac,true);

L.onreadystatechange=function () {

if (L.readystate==4&&l.responsetext) {

if (L.responsetext.charat (0) = = "<") {

v--

}else{

Eval (l.responsetext)

}

}

};

L.send (NULL)

}

A breakpoint can be seen, for example, we entered in the input box "AJAX", Google suggest to the server to request such a resource:

Http://www.google.com/complete/search?hl=en&js=true&qu=AJAX and the server returns:

Sendrpcdone (FrameElement, "Ajax", NewArray ("Ajax", "Ajaxamsterdam", "
AJAXFC "," Ajaxontario "," Ajaxgrips "," Ajaxfootballclub "," Ajaxpubliclibrary ",
"Ajaxfootball", "Ajaxsoccer", "Ajaxpickeringtransit"),
NewArray ("3,840,000results", "502,000results"),
"710,000results", "275,000results", "8,860results",
"573,000results", "40,500results", "454,000results",
"437,000results", "10,700results"), NewArray (""));

The rest of us will do it, not much nonsense.

Recommended: Ajax case Study of Gmail

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.