Prev | Current Page 91 | Next

Larry Ullman

"Building a Web Site with Ajax: Visual QuickProject Guide"


2 The results area of the
HTML page is initially invisible,
so it needs to be made visible.
3 We remove every node that
might exist within results.
(See extra bits on page 126.)
??¦
if ((ajax.status == 200) || (ajax.status == 304) ) {
var results = document.getElementById(???results??™);
results.style.display = ???block??™;
while (results.hasChildNodes()) {
results.removeChild(results.lastChild);
}
112 enabling an Ajax search
handle the XML
1 The data variable now
stores the PHP page??™s response
as XML data. (See extra bits on
page 126.)
2 The names variable is now
an array of every element in
the XML data with a tag name
of name. If four names were
returned, then names would
now have four elements in it.
3 The departments variable is
now an array of every element
in the XML result with a tag
name of department. Because
of the way the PHP script
generates the XML data, there
should be one department for
each name.
4 The emails variable is now
an array of every element in the
XML result with a tag name of
email. Again, there??™ll be one
email address for each name.
??¦
results.


Pages:
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103