Get the App
SLTechnology News&Howtos  ›  Development  › 

What is the effect of ajax Suggest search prompts similar to google?

Shulou Source: shulou.com Published: 2022-06-03 07:52:33 11月15日 Update

What this article shares with you is about the effect of ajax Suggest search tips similar to google. The editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article. Without saying much, let's take a look at it.

Achieve:

_ window.onload = initializeSuggestFramework

With the above two sentences, each named text box has five more attributes:

1.action must. Accepts the data submitted in GET and returns the dynamic page of the relevant Javascript array.

If 2.capture returns more than one column of results (such as the word and Chinese meaning in this example), the column entered by the user will be replaced (starting at 1). Usually this corresponds to the database field.

Optional, default is 1.

The number of columns displayed in the 3.columns drop-down, such as in this case, the words are queried alphabetically and the Chinese meaning is displayed on the right. Optional, default is 1.

4.delay query latency in milliseconds. Lower latency results in a faster response, but increases the burden on the server. Optional, default is 1000 (1 second).

If 5.heading is set to true, the first array value is used as a non-selectable item (title block). It is useful when you have two or more columns of data. Optional, default is false.

Data submission requires only two pieces of data

Name of the 1.type input box

2.Q search keywords (default UTF-8 encoding)

The compressed package you downloaded already contains examples of php and ColdFusion, but of course this framework can be applied to all programming languages without platform restrictions. The background data output is a Javascript statement. The one-dimensional array reads as follows:

New Array ("val1", "val2", "val3")

The two-dimensional array reads as follows:

New Array (

New Array ("row 1, column 1", "row 1, column 2")

New Array ("line 2, column 1", "line 1, column 2")

New Array ("line 3, column 1", "line 1, column 2")

);

Finally, there are four classes that need to be defined in css

.SuggestFramework _ List prompt content area

.SuggestFramework _ Heading the first prompt

.SuggestFramework _ Highlighted set a highlight prompt

.SuggestFramework _ Normal other hints

Download address http://xiazai.jb51.net/200903/yuanma/SuggestFramework-0.31.zip

The above is what the effect of ajax Suggest search tips similar to google is, and the editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

Tags: Hint data array search effect word that is meaning more knowledge article Chinese query input two keyword region unit right Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology Shulou Information Apple macOS OPPO Reno