Professional Ajax


Professional Ajax 2nd Edition provides a developer-level tutorial of Ajax techniques, patterns, and use cases. The book begins by exploring the roots of Ajax, covering how the evolution of the web and new technologies directly led to the development of Ajax techniques. A detailed discussion of how frames, JavaScript, cookies, XML, and XMLHttp requests (XHR) related to Ajax is included. After this introduction, the book moves on to cover the implementation of specific Ajax techniques. Request brokers such as ...
See more details below
Paperback (REV)
$28.99 price
(Save 27%)$39.99 List Price

Pick Up In Store

Reserve and pick up in 60 minutes at your local store

Other sellers (Paperback)
  • All (38) from $1.99   
  • New (16) from $4.12   
  • Used (22) from $1.99   


Professional Ajax 2nd Edition provides a developer-level tutorial of Ajax techniques, patterns, and use cases. The book begins by exploring the roots of Ajax, covering how the evolution of the web and new technologies directly led to the development of Ajax techniques. A detailed discussion of how frames, JavaScript, cookies, XML, and XMLHttp requests (XHR) related to Ajax is included. After this introduction, the book moves on to cover the implementation of specific Ajax techniques. Request brokers such as hidden frames, dynamic iframes, and XHR are compared and contrasted, explaining when one method should be used over another. To make this discussion clearer, a brief overview of HTTP requests and responses is included.

Once a basic understanding of the various request types is discussed, the book moves on to provide in-depth examples of how and when to use Ajax in a web site or web application. Different data transmission formats, including plain text, HTML, XML, and JSON are discussed for their advantages and disadvantages. Also included is a discussion on web services and how they may be used to perform Ajax techniques. Next, more complex topics are covered. A chapter introducing a request management framework explores how to manage all of the requests inside of an Ajax application. Ajax debugging techniques are also discussed.

Professional Ajax 2nd edition is written for Web application developers looking to enhance the usability of their web sites and web applications and intermediate JavaScript developers looking to further understand the language. Readers should have familiarity with XML, XSLT, Web Services, PHP or C#, HTML, CSS.

Professional Ajax 2nd edition adds nearly 200 pages of new and expanded coverage compared to the first edition.

Read More Show Less

Editorial Reviews

From Barnes & Noble
The Barnes & Noble Review
If you’re an experienced programmer who wants to do serious work with Ajax, Professional Ajax was written for you.

Wrox’s authors start with a fast-paced summary of what Ajax can do, the elements of an Ajax solution, and what makes a good Ajax application (for example: minimum server traffic, familiar user interaction, broad accessibility).

Next, they illuminate three Ajax communication options, including hidden frames, iFrames, and XMLHttp requests. You’ll find practical examples of each. The authors also identify pitfalls that require careful programming, including JavaScript’s “same origin policy” security restrictions, and browser caching issues.

Before you dive too far into coding, they introduce several emerging patterns for effective Ajax development: communication control patterns such as “Submission Throttling,” and “fallback” patterns for dealing with server errors and failed client requests.

You’re now ready to see how far Ajax can take you. You’ll build, integrate, and test a web-based Ajax RSS reader: client-side and server-side components, and the links between them. You’ll learn how to use Ajax with web services. There’s a full chapter on using JSON, a lightweight data interchange format that many folks prefer to XML (and is now supported by many Yahoo! APIs). You’ll create four small “web widgets,” and then construct a larger mail application, from architecture to user interface.

Professional Ajax thoroughly illuminates both client and server issues, using server-side examples ranging from PHP to .NET. It even offers a taste of three promising Ajax frameworks: JPSpan, DWR, and Ajax.NET. By the time you’re done, you’ll know how to take Ajax to the limit. Bill Camarda, from the April 2006 Read Only

Read More Show Less

Product Details

  • ISBN-13: 9780470109496
  • Publisher: Wiley
  • Publication date: 3/12/2007
  • Series: Programmer to Programmer Series
  • Edition description: REV
  • Edition number: 2
  • Pages: 624
  • Product dimensions: 7.40 (w) x 9.20 (h) x 1.30 (d)

Meet the Author

Nicholas C. Zakas has a BS in Computer Science from Merrimack College and an MBA from Endicott College. He is the author of Professional JavaScript for Web Developers (Wiley 2005) as well as several online articles. Nicholas works for Yahoo! as a frontend engineer and has worked in web development for more than 6 years, during which time he has helped develop web solutions in use at some of the largest companies in the world. Nicholas can be reached through his web site at

Jeremy McPeak began tinkering with web development as a hobby in 1998. Currently working in the IT department of a school district, Jeremy has experience developing web solutions with JavaScript, PHP, and C#. He has written several online articles covering topics such as XSLT, WebForms, and C#. He is also co-author of Beginning JavaScript, 3rd Edition (Wiley 2007). Jeremy can be reached through his web site at

Joe Fawcett started programming in the 1970s and briefly worked in IT upon leaving full-time education. He then pursued a more checkered career before returning to software development in 1994. In 2003 he was awarded the title of Microsoft Most Valuable Professional in XML for community contributions and technical expertise. He currently works in London as a developer for FTC Kaplan, a leading international provider of accountancy and business training, where he specializes in systems integration.

Read More Show Less

Table of Contents

Introduction xv

Chapter 1: What Is Ajax? 1

Ajax Is Born 2

The Evolution of the Web 2

JavaScript 2

Frames 3

The Hidden Frame Technique 3

Dynamic HTML and the DOM 3

Iframes 4

XMLHttp 4

The Real Ajax 5

Ajax Principles 6

Technologies behind Ajax 6

Who Is Using Ajax? 7

Google Suggest 7

Gmail 8

Google Maps 9

A9 10

Yahoo! News 11

Bitflux Blog 12

Confusion and Controversy 13

Ajax and Web 2.0 14

Summary 15

Chapter 2: Ajax Basics 17

HTTP Primer 17

HTTP Requests 18

HTTP Responses 20

Ajax Communication Techniques 21

The Hidden Frame Technique 21

XMLHttp Requests (XHR) 37

Ajax with Images 50

Dynamic Script Loading 59

Cache Control 63

Summary 63

Chapter 3: Ajax Patterns 65

Communication Control Patterns 65

Predictive Fetch 66

Page Preloading Example 66

Submission Throttling 74

Incremental Form Validation Example 76

Incremental Field Validation Example 82

Periodic Refresh 85

New Comment Notifier Example 86

Multi-Stage Download 90

Additional Information Links Example 91

Fallback Patterns 93

Cancel Pending Requests 94

Try Again 96

Summary 97

Chapter 4: Ajax Libraries 99

The Yahoo! Connection Manager 99

Setup 99

Basic Requests 100

The Callback Object 100

Monitoring and Managing Requests 104

Form Interaction 104

File Uploads 105

GET Example 106

POST Example 107

Additional Features 108

Limitations 108

Prototype 109

The Ajax.Request Object 109

The Options Object 109

GET Example 112

POST Example 113

The Ajax.Updater Object 113

The Ajax.Responders Object 115

Advantages and Disadvantages 117

jQuery 117

Simple jQuery Expressions 117

Executing GET Requests 118

GET Example 119

The $.post() Method 120

POST Example 120

The load() Method 122

The $.ajax() Method 123

The ajaxStart() and ajaxStop() Methods 124

Limitations 124

Summary 125

Chapter 5: Request Management 127

Priority Queues 127

The RequestManager Object 131

Request Description Objects 132

Queuing Requests 133

Sending Requests 134

Cancelling Requests 139

Age-Based Promotion 141

Handling Ajax Patterns 142

Using RequestManager 145

Summary 148

Chapter 6: XML, XPath, and XSLT 149

XML Support in Browsers 149

XML DOM in IE 149

XML in Other Browsers 159

Cross-Browser XML 162

A Basic XML Example 163

XPath Support in Browsers 170

Introduction to XPath 170

XPath in IE 172

Working with Namespaces 173

XPath in Other Browsers 175

Working with a Namespace Resolver 177

Cross-Browser XPath 178

XSL Transformation Support in Browsers 179

Introduction to XSLT 180

XSLT in IE 182

XSLT in Other Browsers 187

Cross-Browser XSLT 189

Best Picks Revisited 189

Summary 192

Chapter 7: Syndication with RSS and Atom 193

RSS 193

RSS 0.91 194

RSS 1.0 195

RSS 2.0 196

Atom 196

XParser 197

The xparser Namespace 197

Retrieving the Data 198

The Abstract Classes 198

Creating a News Ticker 210

The Server-Side Component 210

The Client-Side Component 211

Styling the News 221

Using the News Ticker Widget 222

Web Search with RSS 223

The Server-Side Component 224

The Client-Side Component 225

Customizing the Web Search Widget 232

Using the Web Search Widget 234

Summary 235

Chapter 8: JSON 237

What Is JSON? 237

Array Literals 237

Object Literals 238

Mixing Literals 239

JSON Syntax 240

JSON Encoding/Decoding 241

JSON versus XML 242

Server-Side JSON Tools 243


Other Tools 245

Creating an Autosuggest Textbox 246

Functionality Overview 246

The HTML 247

The Database Table 249

The Architecture 249

The Classes 250

The AutoSuggest Control 250

The Suggestion Provider 267

The Server-Side Component 268

The Client-Side Component 270

Summary 272

Chapter 9: Comet 273

HTTP Streaming 274

Request Delays 274

File Modification Example 276

Using Iframes 277

Browser-Specific Approaches 282

Server-Sent DOM Events 291

Connection Management 296

Server-Side Support 297

Summary 298

Chapter 10: Maps and Mashups 299

The Rise of Mashups 300

Geocoding 300

Geocoding Web Sites 300

Geocoding Services 301

Google Maps API 301

How Does It Work? 301

Getting Started 302

Google Maps Basics 303

Controls 304

Moving the Map 306

Info Windows 306

Events 311

Map Overlays 313

Additional Information 321

Yahoo! Maps API 321

Getting Started 321

Yahoo! Maps Basics 322

Controls 324

Moving the Map 325

Smart Windows 326

Events 327

Map Overlays 328

Address Lookup 334

Additional Information 334

Other Mapping APIs 335

Summary 335

Chapter 11: Ajax Debugging Tools 337

The Problem 337

FireBug 338

Installation and Setup 338

The Interface 339

XHR Logging 340

Ajax Debugging with FireBug 341

FireBug Limitations 342

Microsoft Fiddler 342

Installation and Setup 343

The Interface 344

HTTP Breakpoints 347

Ajax Debugging with Fiddler 348

Summary 349

Chapter 12: Web Site Widgets 351

Creating a Weather Widget 351

The SDK 351

The Server-Side Component 352

The Client-Side Component 361

Getting Data from the Server 361

Customizing the Weather Widget 362

Setting Up the Weather Widget as an Application 366

Adding the Weather Widget to the Web Page 370

Watching Stocks 371

Getting Yahoo! Finance Information 371

The Stock Quote Proxy 372

Client Component: The AjaxStockWatcher Class 376

Customizing the Stock Quotes 385

Using the Stock Watcher Widget 387

Creating a Site Search Widget 388

The Server-Side Component 389

The Client-Side Component 398

Customizing the Site Search Widget 403

Adding the Site Search Widget to a Page 405

Summary 406

Chapter 13: Ajax Frameworks 407

JPSpan 407

Using JPSpan 408

JPSpan Example 412

Summary of JPSpan 415

DWR 416

Using DWR 416

DWR Example 419

More about dwr.xml 424

Summary of DWR 427

Ajax.NET Professional 427

Using Ajax.NET Professional 427

Type Conversion 429

Session Access 430

Ajax.NET Professional Example 431

Summary of Ajax.NET Professional 436

Summary 436

Chapter 14: ASP.NET AJAX Extensions (Atlas) 437

Requirements and Setup 438

The AJAX Client Library 438

Accessing the Client Tools with ASP.NET 438

Accessing the Client Tools without ASP.NET 439

Using Classes 440

Writing Code with the ASP.NET AJAX Library 440

Using Controls 446

Making HTTP Requests 451

The UpdatePanel Control 455

Adding the UpdatePanel to the Page 455

Adding Content to the UpdatePanel 456

Triggering an Update 457

Finishing Up 458

SiteSearch Revisited 459

The User Interface 459

Getting Started 460

Declaring the Form 460

Performing the Search 462

Clearing the Results 467

Handling Errors 467

Hooking Up the Events 468

Summary 470

Chapter 15: Case Study: FooReader.NET 471

The Client Components 472

The User Interface 472

Styling the Interface 475

Driving the UI 481

The Server Application 495

Possible Paradigms 495

Implementation 496

Setup and Testing 506

Summary 508

Chapter 16: Case Study: AjaxMail 509

Requirements 509

Architecture 510

Resources Used 510

The Database Tables 511

The Configuration File 512

The AjaxMailbox Class 513

Performing Actions 535

The User Interface 541

The Folder View 544

Read View 546

Compose View 548

Layout 550

Tying It All Together 550

Helper Functions 552

The Mailbox 553

Callback Functions 571

Event Handlers 573

The Last Step 573

Summary 574

Appendix A: Licenses for Libraries and Frameworks 575

Index 583

GNU General Public License 600

Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star


4 Star


3 Star


2 Star


1 Star


Your Rating:

Your Name: Create a Pen Name or

Barnes & Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation


  • - By submitting a review, you grant to Barnes & and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Terms of Use.
  • - Barnes & reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing 1 Customer Reviews
  • Anonymous

    Posted February 18, 2006

    Outstanding platform-agnostic look at Ajax programming

    The book does a good job academically of showing how Ajax has evolved (itself a debatable topic) and how it is used in modern-day applications. The book doesn't marry the reader to any one particular web development framework, effectively citing examples in PHP, .NET, and JavaServer Pages. Practically, the authors exhibit a proper mix of (X)HTML, CSS, JavaScript, Dynamic HTML and XmlHttpRequests, showing how the technologies are blended for developing next-gen UIs. There are great discussions of advanced concepts like JSON, REST, and SOAP-based web services and how Ajax is incorporated into them. Also, coding to allow cross-browser compatibility is stressed throughout the book, particularly in instantiating an XMLHTTP object across IE, Firefox, Mozilla and Safari. The authors' zXml and XParser are cited as two of several third-party libraries to seamlessly pull this off. Some gems that I found within the book include Chapter 8 - 'Web Site Widgets', which is very helpful, giving practical demonstrations and usable code for several Ajax-driven mini-applications we could all use in our web projects. Chapter 7's case study of a Google Suggest-style autocomplete text box was very elegant, using JSON as an alternative to XML's typically verbose payload. Chapter 2 - 'Ajax Patterns' also abstracts many of the features common to apps using Ajax (i.e., polling, autosave, incremental updating). All are well done and greatly appreciated. Syntactically, the authors' programming style is very clever. While not exhaustively described, the book shows how to feign object-oriented programming in client-side JavaScript, making liberal use of such time-saving coding tricks like faux classes, inline function definitions and prototypes. In criticism, the one chapter I found to be a letdown was Chapter 5 - 'RSS/Atom', mainly because I'm very involved with work in that space. A terse description of content syndication is presented, but then followed exclusively by an analysis the FooReader.NET web-based RSS aggregator app. It's nice, but doesn't take a more holistic view of how Ajax is being used elsewhere. I would have also liked to see examples in emerging platforms, specifically Ruby on Rails and the Ajax support built directly into that web framework. But overall this is a very good introductory read for experienced programmers wanting to get up to speed on the next big thing in advanced web UI development. I'm a better, more aware, more prepared developer for having read it.

    1 out of 1 people found this review helpful.

    Was this review helpful? Yes  No   Report this review
Sort by: Showing 1 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)