SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 160 | Next

Jonathan Snook, Aaron Gustafson, Stuart Langridge, and Dan Webb

"Accelerated DOM Scripting with Ajax, APIs, and Libraries"

..


Time: fact or fiction
Dr. Michelle Doe
Is time just a figment of our imagination?...


Here??™s the base structure of the HTML page that includes how you want to style each of
the elements after you get them into the page. The book list will be inserted into the element
with the ID of books:
"http://www.w3.org/TR/html4/strict.dtd">


Books

CHAPTER 5 n AJAX AND DATA EXCHANGE 107





The goal is to loop through each item and end up with the following HTML structure:

The Long Road


Jonah Smith


Smith details his battles from the mailroom to the CEO of Megacorp



Within the response of the Ajax call, use getElementsByTagName() to retrieve all the book
elements, looping through each one to add to the page. Using DOM methods, each of the elements
and text nodes has to be created and appended to other nodes until finally the entire
book branch can be appended into the books element:
var doc = transport.


Pages:
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172