AJAX can be used to create more user-friendly and interactive searches.
The Below example will demonstrate a live search, where you get search results while you
Live search has many benefits compared to traditional searching:
Search for a QcTutorials page in the input field below:
When a user types a character in the input field above, the function "showResult()" is
executed. The function is triggered by the "onkeyup" event:
Source code explanation:
If the input field is empty (str.length==0), the function clears Content of the livesearch
placeholder and exits the function.
If the input field is not empty, the showResult() function executes the following:
The source code in "livesearch.html" searches an XML file for titles matching the
search string and returns the Output Will Be :
Your Query was successfully sent!