Using Ajax Agent and PHP for Auto-Complete

Written By: Jay

- 15 Jun 2006 -
















Description: In this HOWTO I will explain how to use AjaxAgent and PHP to create an Ajax Auto-Complete box with a drill-down list of data. The UI is very simple. It consists of a TextBox to enter an Artists' Name, a selectbox to display the Albums and an unordered list to display the songs on an album.

  1. Auto Complete
  2. Posting Back
  3. On Your Own

Part 3: On Your Own

Your last task is to use the OnClick() event in the Albums list to return a list of Tracks on an Album.

Remeber this is a 2 part process.

Part 1: Define a a PHP function that search for an Array of Tracks using the Album Name.

Part 2: On the client side:
     A: define a JS function that invokes the agent.call function and passes it the Album Name.
     B: Define an Callback function that handles the response from the server-side PHP function and then binds it to an html control.

It's very easy to do so you should give it a shot before peaking at the source code.

<< Previous