|
|
Registered tutorials: 501 Registered Users: 24390
|
|
Rating: 3.15 out of 13 votes cast
Category: Ajax and PHP
|
Using Ajax Agent and PHP for Auto-Complete
Abstract: Explains how to use AjaxAgent and PHP to create an Ajax Auto-Complete box with a drill-down list of data.
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.
- Auto Complete
- Posting Back
- On Your Own
Part 1: Auto Complete
Start by creating a new PHP page and placing the agent.php file in the same directory. Open your new PHP page in an editor and start hacking away.
First create the HTML Form controls we will be using:
- txtArtists = TextBox to type the ArtistName in.
- matches = A SelectBox with an onclick event which will be used to send the ArtistName to the AlbumSearch method we will be creating.
- txtArtistID = Hidden to hold the selected ArtistName (js cannot see the select box because it is hidden?)
- htmlOutput = An empty DIV when we will be creating a list of Albums
- htmlOutputTracks = An empty DIV when we will be creating a list of Tracks
HTML:
<form>
<input name="artistName" id="artistName" size="20" type="text"
onkeyup="GetArtist();return false;" autocomplete="off">
<br>
<select id="matches" style="VISIBILITY: hidden"
onclick="MatchSelected(this);" ></select>
<hr>
<div id="htmlOutput"></div>
<hr>
<div id="htmlOutputTracks"></div>
</form>
|
Reviews:
Rate and Review This Site
No reviews yet
Statistic Information About this Resource:
| Total Hits: |
2154 |
| Unique Hits: |
1813 |
| |
Daily |
Weekly |
Monthly |
| |
Unique |
Total |
Unique |
Total |
Unique |
Total |
| Average |
2.6 |
2.7 |
18.2 |
21.4 |
62.1 |
72.3 |
| Current |
3 |
3 |
16 |
16 |
58 |
74 |
| Previous |
6 |
6 |
16 |
18 |
131 |
147 |
| Jul 22 |
5 |
5 |
14 |
24 |
0 |
0 |
| Jul 21 |
2 |
2 |
23 |
28 |
94 |
105 |
| Jul 20 |
4 |
4 |
21 |
24 |
94 |
113 |
| Jul 19 |
2 |
2 |
0 |
0 |
78 |
90 |
| Jul 18 |
0 |
0 |
36 |
44 |
0 |
0 |
| Jul 17 |
1 |
1 |
21 |
22 |
79 |
98 |
| Jul 16 |
2 |
3 |
35 |
38 |
40 |
43 |
| Jul 15 |
1 |
1 |
0 |
0 |
47 |
53 |
| Highest |
17 |
19 |
71 |
84 |
227 |
276 |
|
|
|
Script Execution Time: 7.57885 | SQL Queries: 10 | Members: 501
Ajax Tutorial Top List - Powered by Aardvark Topsites PHP 5.1.2
|