7. enabling an
Ajax search
99
what we??™ll do
1 First, on page 102, we??™ll modify the HTML page
to include the necessary Ajax pieces.
2 The user enters the fi rst couple of letters of the
employee??™s last name and clicks GO. (See extra bits
on page 124.)
3 On Ajax-enabled browers, the page-specifi c Java-
Script will read in what the user typed and submit
that to a new PHP script. On pages 103-106, we??™ll
begin the JavaScript fi le that starts this process.
4 The PHP script, written on pages 107-110, will
search the database for employees whose name
begins with the provided letters. It will return any
matched records as XML data.
5 The JavaScript will take the XML returned by
the PHP script and use it to update the HTML page.
We??™ll complete this JavaScript fi le on pages 111-122.
6 Naturally, we??™ll test what we??™ve built on page 123
to make sure it all works.
7 At the end of this chapter, in the extra bits section,
you??™ll fi nd more information, tips, and recommendations
regarding all of these steps.
100 enabling an Ajax search
HTML page
Form data
XML data
enabling an Ajax search 101
add the Ajax elements
1 Include the generic Ajax JavaScript fi le by adding the right code to the
HTML head.
Pages:
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96