The two most
popular ways to do this are by using JSON and XML.
JSON (http://json.org), which stands for JavaScript Object Notation, uses a subset of
JavaScript to safely define and transport data. JSON parsers are available for dozens of
CHAPTER 4 n LIBRARIES 84
server-side languages, making it extremely easy to integrate into a project. JSON has slowly
been taking over XML in popularity for transporting data from the server side to the client
side for a couple of reasons:
??? JSON is almost always smaller in size because less markup is needed to define the data.
??? JSON is quicker to parse and use on the client side because it is native JavaScript.
XML support was built into the responseXML property of the original XHR object being
returned. With an XML object, you can use familiar DOM methods to traverse the XML.
JavaScript libraries make handling JSON and XML easier by being able to automatically
detect which type of data is being returned by an XHR call and parse it appropriately. With
JSON, the data can be parsed to prevent against invalid or dangerous information being
served up from the server.
Widgets
Widgets are prebuilt components (such as file browsers, tabbed interfaces, or custom dialogs)
that can be plugged into an application and solve a discrete task, as can be seen in Figure 4-1.
Widgets essentially combine the first two categories??”DOM manipulation and application
conveniences??”into a well-oiled machine.
Pages:
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146