...

View Full Version : Live Search without divs



Hardist
07-13-2012, 07:41 AM
Hey guys and girls,

I've been looking for a script that basically changes my query whenever I enter something in an input field. I only want this to change in my query upon typing something:


LIKE '$search'

I have a big page with a lot of code, tables, and so on, and I would like the output of this to change whenver I type something in the input field. I have a grocery list where I can select the groceries I will be needing for the next week. I have a LOT of groceries displayed on one page, within one query, about 120 items. It sucks to always search for the stuff using CTRL+F for example, and I do not want to hit any submit buttons each time I am searching using an input field. I want a live search, something very basic, but what does the job.

For example, this is how my page looks like after getting the information from the database table:


<table>
<tr>
<td>Name</td>
<td>Age</td>
<td>E-Mail</td>
</tr>

<tr>
<td>Alpha</td>
<td>25</td>
<td>alpha@something.com</td>
</tr>

<tr>
<td>Bravo</td>
<td>30</td>
<td>alpha@something.com</td>
</tr>

<tr>
<td>Charlie</td>
<td>35</td>
<td>alpha@something.com</td>
</tr>

</table>

Now, whenever I type the letter "A" into my input field, I only want this to be displayed (and it should be changing live whenever I type the "A"):


<table>
<tr>
<td>Name</td>
<td>Age</td>
<td>E-Mail</td>
</tr>

<tr>
<td>Alpha</td>
<td>25</td>
<td>alpha@something.com</td>
</tr>

</table>

But the thing is, I want this to change without hitting any submit buttons. I have found loads of scripts that can do this, but my problem is always that the results are being displayed in a div or in another input field or whatever. I only want my query to change whenever I type something.

Does anyone have a simple, basic script that can handle this or can someone point me into the right direction? Thanks in advance!!

Hardist
07-13-2012, 08:03 AM
Maybe easier to explain, I would like to have what google does, display results when you type (Not autocomplete though, just the search results).

Keleth
07-13-2012, 02:47 PM
It is an autocomplete, or works on the same principles. Instead of filling the results into a div positioned according to the input box, you fill them into your page, or a container, or anything. Its the same exact script with a different target location.

The basics are simple: AJAX. As someone types, you do a query though an AJAX request, take the results of that request and display it to a user. You control whether its an autocomplete or a results.

Hardist
07-15-2012, 11:22 AM
Believe me, I have tried. But the thing is, my results are already all displayed. When I am searching, and typing in the input field, I simply want the results to narrow down to the things I am typing.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum