Skip to main content

Professional Ajax

Nicholas C. Zakas, Jeremy McPeak, Joe Fawcett

ISBN: 978-0-470-03610-5

Aug 2007

406 pages

Select type: E-Book

Product not available for purchase

Description

Written for experienced web developers, Professional Ajax shows how to combine tried-and-true CSS, XML, and JavaScript technologies into Ajax. This provides web developers with the ability to create more sophisticated and responsive user interfaces and break free from the ""click-and-wait"" standard that has dominated the web since its introduction.

Professional Ajax discusses the range of request brokers (including the hidden frame technique, iframes, and XMLHttp) and explains when one should be used over another. You will also learn different Ajax techniques and patterns for executing client-server communication on your web site and in web applications. By the end of the book, you will have gained the practical knowledge necessary to implement your own Ajax solutions. In addition to a full chapter case study showing how to combine the book's Ajax techniques into an AjaxMail application, Professional Ajax uses many other examples to build hands-on Ajax experience. Some of the other examples include:

  • web site widgets for a news ticker, weather information, web search, and site search
  • preloading pages in online articles
  • incremental form validation
  • using Google Web APIs in Ajax
  • creating an autosuggest text box
Professional Ajax readers should be familiar with CSS, XML, JavaScript, and HTML so you can jump right in with the book and begin learning Ajax patterns, XPath and XSLT support in browsers, syndication, web services, JSON, and the Ajax Frameworks, JPSpan, DWR, and Ajax.NET.
Acknowledgments.

Introduction.

Chapter 1: What Is Ajax?

Ajax Is Born.

The Evolution of the Web.

JavaScript.

Frames.

The Hidden Frame Technique.

Dynamic HTML and the DOM.

Iframes.

XMLHttp.

The Real Ajax.

Ajax Principles.

Technologies Behind Ajax.

Who Is Using Ajax?

Google Suggest.

Gmail.

Google Maps.

A9.

Yahoo! News.

Bitflux Blog.

Confusion and Controversy.

Summary.

Chapter 2: Ajax Basics.

HTTP Primer.

HTTP Requests.

HTTP Responses.

Ajax Communication Techniques.

The Hidden Frame Technique.

XMLHttp Requests.

Further Considerations.

The Same Origin Policy.

Cache Control.

Summary.

Chapter 3: Ajax Patterns.

Communication Control Patterns.

Predictive Fetch.

Page Preloading Example.

Submission Throttling.

Incremental Form Validation Example.

Incremental Field Validation Example.

Periodic Refresh.

New Comment Notifier Example.

Multi-Stage Download.

Additional Information Links Example.

Fallback Patterns.

Cancel Pending Requests.

Try Again.

Summary.

Chapter 4: XML, XPath, and XSLT.

XML Support in Browsers.

XML DOM in IE.

XML DOM in Firefox.

Cross-Browser XML.

A Basic XML Example.

XPath Support in Browsers.

Introduction to XPath.

XPath in IE.

Working with Namespaces.

XPath in Firefox.

Working with Namespace Resolver.

Cross-Browser XPath.

XSL Transformation Support in Browsers.

Introduction to XSLT.

XSLT in IE.

XSLT in Firefox.

Cross-Browser XSLT.

Best Picks Revisited.

Summary.

Chapter 5: Syndication with RSS/Atom.

RSS.

RSS 0.91.

RSS 1.0.

RSS 2.0.

Atom .

FooReader.NET.

Client-Side Components.

Server-Side Components.

Tying the Client to the Server.

Setup.

Testing.

Summary.

Chapter 6: Web Services.

Related Technologies.

SOAP.

WSDL.

REST.

The .NET Connection.

Design Decisions.

Creating a Windows Web Service.

System Requirements.

Configuring IIS.

Coding the Web Service.

Creating the Assembly.

Web Services and Ajax.

Creating the Test Harness.

The Internet Explorer Approach.

The Mozilla Approach.

The Universal Approach.

Cross-Domain Web Services.

The Google Web APIs Service.

Setting Up the Proxy.

Summary.

Chapter 7: JSON.

What Is JSON?

Array Literals.

Object Literals.

Mixing Literals.

JSON Syntax.

JSON Encoding/Decoding.

JSON versus XML.

Server-Side JSON Tools.

JSON-PHP.

Other Tools.

Creating an Autosuggest Text Box.

Functionality Overview.

The HTML.

The Database Table.

The Architecture.

The Classes.

The AutoSuggest Control.

The Suggestion Provider.

The Server-Side Component.

The Client-Side Component.

Summary.

Chapter 8: Web Site Widgets.

Creating a News Ticker Widget.

The Server-Side Component.

The Client-Side Component.

Styling the News.

Implementing the News Ticker Widget.

Creating a Weather Widget.

The Weather.com SDK.

The Server-Side Component.

The Client-Side Component.

Getting Data from the Server.

Customizing the Weather Widget.

Implementing the Weather Widget.

Creating a Web Search Widget.

The Server-Side Component.

The Client-Side Component.

Customizing the Web Search Widget.

Implementing the Web Search Widget.

Creating a Site Search Widget.

The Server-Side Component.

The Client-Side Component.

Customizing the Site Search Widget.

Implementing the Site Search Widget.

Summary.

Chapter 9: AjaxMail.

Requirements.

Architecture.

Resources Used.

The Database Tables.

The Configuration File.

The AjaxMailbox Class.

Performing Actions.

The User Interface.

The Folder View.

Read View.

Compose View.

Layout.

Tying It All Together.

Helper Functions.

The Mailbox.

Callback Functions.

Event Handlers.

The Last Step.

Summary.

Chapter 10: Ajax Frameworks.

JPSpan.

How It Works.

Installing JPSpan.

Creating the Server-Side Page.

Creating the Client-Side Page.

Error Handling.

Type Translation.

Summary of JPSpan.

DWR.

How It Works.

Installing DWR.

Creating the Client-Side Page.

Using a Custom Class.

Error Handling.

More about dwr.xml.

Converters.

Summary of DWR.

Ajax.NET.

How It Works.

Installing Ajax.NET.

Creating the Web Page.

Simple and Complex Types.

Session State.

Summary of Ajax.NET.

Summary.

Index.

  • Ajax is the hottest technology trend for web developers and it is standards based so it works with both Internet Explorer and FireFox
  • Ajax combines 3 already hot technologies: CSS, XML, and JavaScript and gives professional web developers the ability to create more sophisticated and responsive user interfaces (like Flash) but without requiring proprietary development tools or browser add-ins
  • Some of the topics covered include:
  • Ajax communication methods
  • Ajax Patterns
  • Using XML information natively and through the use of JavaScript
  • Building a web based Ajax RSS reader
  • Web services including calling web services from JavaScript
  • JavaScript Object Notation (JSON)
  • Ajax Web site ""widget"" examples using Web services, JSON, PHP, .Net, and RSS including news, weather, RSS, web search, and web mail
  • Ajax Frameworks
Chapter Downloads - Updated 4/17/06 Download
234Error in Text/Code,Page 34, bottom of page next to last line of code:

Text reads:
throw new Error( XMLHttp object could be created. );

It should read:
throw new Error( XMLHttp object could not be created. );
07/20/2006
359Error in Code,Chapter 3, page 59, gray code block at top of page 5th line from end:

Text reads:
<option>Male</option></option>Female</option>

It should read:
<option>Male</option><option>Female</option>
07/20/2006
99Error in Code (twice a line),The first code snippet reads:

var oCurrentChild = aBooks[i].firstChild;

do {
switch (oCurrentChild.tagName) {
case title :'
sTitle = oCurrentChild.text;
break;
case author :
sAuthor = oCurrentChild.text;
break;
case publisher :
sPublisher = oCurrentChild.text;
break;
default:
break;
}
oCurrentChild = oCurrentChild.nextSibling;
} while (oCurrentChild = oCurrentChild.nextSibling);


The first code snippet should read:


var oCurrentChild = aBooks[i].firstChild;

do {
switch (oCurrentChild.tagName) {
case title :'
sTitle = oCurrentChild.text;
break;
case author :
sAuthor = oCurrentChild.text;
break;
case publisher :
sPublisher = oCurrentChild.text;
break;
default:
break;
}
} while (oCurrentChild = oCurrentChild.nextSibling);
05/08/2006
109Error in Text,second line:
ORDERED_NOE_ITERATOR_TYPE

should be:
ORDERED_NODE_ITERATOR_TYPE
4/24/06
4110Error in Code,gray code block at bottom of page, first line:
var sNameSpace = xmlns:na='http://site1.com' xmlns:pub='http://site2.com' ;

should be:
var oNameSpace = { na : http://site1.com , pub : http://site2.com };
12/21/2007
4111Error in Code,gray code block at top of page, first line:
var oNodes = zXPath.selectNodes(oRoot, sXPath, sNameSpace);

should be:
var oNodes = zXPath.selectNodes(oRoot, sXPath, oNameSpace);
12/21/2007