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 278 | Next

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

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

The help sidebar feature is very
simple, but with large projects the gains in maintainability become even more apparent. You
can separate a very complex JavaScript project up into several behaviors that are then glued
into the document via Event.addBehavior(). If the HTML structure changes, it??™s trivial to
adapt your scripts.
When It Comes to Ajax, Simple Is Best
There are many methods of communication between JavaScript and the server side. Of
course, originally, there was the X in Ajax: XML. Since then JSON, RJS, and plain HTML have
emerged as other formats, as well as a whole raft of more niche technologies. The rule of
thumb here is to go for the simplest method possible to get the job done. In most cases you
don??™t even need anything as rich as JSON; most of the time you can just send a request, return
a chunk of update HTML and replace the relevant part of the document with it. Prototype??™s
Ajax.Updater makes this method extremely simple.
In this project, Ajax.Updater is used to great effect. There??™s no need to wrap the Ajax
responses up in JSON and then write code to unpack it and handle it on the client side, so the
returned HTML is simply placed into the sidebar
.
CHAPTER 9 n A DYNAMIC HELP SYSTEM 206
There are numerous advantages to keeping your Ajax communications simple. Because
each user needs to download and execute the JavaScript code on each computer, less code is
always best.


Pages:
266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6