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.

 

AJAX INTEGRATION
Dynamically filter the list

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:

 

Dynamic Result (Pulled from database)

IDNameAgeEmail
1Ben Beaumont27ben@runrev.com
2James Johnson31james@thejohnsons.com
3Michael Jordan50michael@basketballstars.com
4Tony Blair55ex-priminister@theuk.com
5Jonathan Edwards42triple@jump.com
6Steve Jobs54steve@apple.com
7Bill Gates53bill@microsoft.com
8Big Bird34bigbird@thestreet.com
9Ben Symes22ben.symes@runrev.com
10Barack Obama47barack@theusa.com
11David Brent54david@funny.com
12Graeme Gooch66bat@thecricketball.com
13Steven Spielberg62me@moviemaking.com