Code Example |
|
1 | We need to link to the main jQuery library which can be downloaded from www.jquery.com. This library provides all the base functionality that allows us to listen for key strokes in a field. This is done by adding the following line of code to the <head> of your.lc file. |
2 | The second step is to add the javascript code that listens for key-up messages in our input box. When a key stroke is detected, this code re-loads our database query script (Step 3) with the text the user has typed as a filter. |
3 |
The final step is to create a seperate .lc file that contains the script to get the data from the database. The search term is passed to the script as a GET variable.
|
In this example we will show you how easy it is to use jQuery with your.lc scripts. We are using the lastest jQuery libraries to filter the people in our list based on their name.
Name:
ID | Name | Age | |
1 | Ben Beaumont | 27 | ben@runrev.com |
2 | James Johnson | 31 | james@thejohnsons.com |
3 | Michael Jordan | 50 | michael@basketballstars.com |
4 | Tony Blair | 55 | ex-priminister@theuk.com |
5 | Jonathan Edwards | 42 | triple@jump.com |
6 | Steve Jobs | 54 | steve@apple.com |
7 | Bill Gates | 53 | bill@microsoft.com |
8 | Big Bird | 34 | bigbird@thestreet.com |
9 | Ben Symes | 22 | ben.symes@runrev.com |
10 | Barack Obama | 47 | barack@theusa.com |
11 | David Brent | 54 | david@funny.com |
12 | Graeme Gooch | 66 | bat@thecricketball.com |
13 | Steven Spielberg | 62 | me@moviemaking.com |