I’m following the tutorial from w3schools on ajax search and I’m having some trouble tweaking the code. The structure I got is:
search.php – ( Where the search terms ?q=search will output a result as echo $result )
livesearch.php – ( Where it will exchange information between search.php and search.html )
search.html – ( Where it contains java script and what not )
How can I, please, make it instead of grabbing information from XML, grab from the output string in search.php? In other words, if the HTTP request is “livesearch.php?q=searchTerm”, I want to output “searchTerm.”
The tutorial on the site is providing you with that answer:
responseText. If you set that to an element’sinnerHTML, of course, it’ll display as HTML.I would suggest not reinventing the wheel, though, and use jQuery, Prototype, or some other JS framework for that kind of thing.