Printable Version of Topic

Click here to view this topic in its original format

HTMLHelp Forums _ General Web Design _ PHP Example - AJAX Live Search help modifications

Posted by: Dohm Mar 5 2021, 02:35 PM

I’m using the example of from https://www.w3schools.com/php/php_ajax_livesearch.asp PHP Example - AJAX Live Search which searches in the xml file and works perfect.

Now what I would like to do is to have this search the "title" only and when it will do the filter, in the search box, and when the user selects this "Title", it will go on a specific page and not create a new page.. _self
What it is doing right now is when on click text from the search box, it creates a new page.

How would I go about to do the following...

Example1 insert text in search box: "test1" on click go to the designated _self page of <a href="subpages/code/test1.html"</a>
Example2 insert text in search box: "test2" on click go to the designated _self page of <a href="subpages/code/test2.html"</a>

So that if I have more test to create in the "links.xml" file, I would just need to upload it.

What i'm trying to do is to have a main search on my index.php and to not have to show every test text on the page but to search within the links.xml file (php/links.xml) and show the results in the search box, once the search is complete with the results, the user will be taken to this specific page. (_self not _blank or new)

I am working with a basic search/filter using

CODE
<ul id="myUL">
. Which is a cluster... Pretty new to this as I am learning as I go.

CODE

<input type="text" id="myInput" onkeyup="myFunction()" placeholder="Search for title..">

<ul id="myUL">
<li class="invalid nav-item"><a href="subpages/code/test1.html">test1</a></li>                        
<li class="invalid nav-item"><a href="subpages/code/test2.html">test2</a></li>
</ul>

I have around 1000 test page


So from:
CODE

<link><title>test1</title><url>https://www.w3schools.com/tags/tag_a.asp</url>
<link><title>test2</title><url>https://www.w3schools.com/tags/tag_a.asp</url>


To
CODE

<link><title>test1</title><url><a href="subpages/code/test1.html"</a></url>
<link><title>test2</title><url><a href="subpages/code/test2.html"</a></url>

Is this possible...

Or reading material so I can see what I need to do...

Thank you in advance.

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)