You are previewing Ajax: Creating Web Pages with Asynchronous JavaScript and XML.
O'Reilly logo
Ajax: Creating Web Pages with Asynchronous JavaScript and XML

Book Description

The Easy, Example-Based Guide to Ajax for Every Web Developer

Using Ajax, you can build Web applications with the sophistication and usability of traditional desktop

applications and you can do it using standards and open source software. Now, for the first time,

there's an easy, example-driven guide to Ajax for every Web and open source developer, regardless of

experience.

Edmond Woychowsky begins with simple techniques involving only HTML and basic JavaScript. Then,

one step at a time, he introduces techniques for building increasingly rich applications. Don't worry if

you're not an expert on Ajax's underlying technologies; Woychowsky offers refreshers on them, from

JavaScript to the XMLHttpRequest object. You'll also find multiple open source technologies and open

standards throughout, ranging from Firefox to Ruby and MySQL.

You'll not only learn how to write "functional" code, but also master design patterns for writing rocksolid,

high-performance Ajax applications. You'll also learn how to use frameworks such as Ruby on

Rails to get the job done fast.

  • Learn how Ajax works, how it evolved, and what it's good for

  • Understand the flow of processing in Ajax applications

  • Build Ajax applications with XML and the XMLHttpRequest object

  • Integrate back-end code, from PHP to C#

  • Use XSLT and XPath, including XPath Axis

  • Develop client-side Ajax libraries to support code reuse

  • Streamline development with Ruby on Rails and the Ruby programming language

  • Use the cross-browser HTML DOM to update parts of a page

  • Discover the best Ajax Web resources, including Ajax-capable JavaScript libraries

  • Table of Contents

    1. Copyright
      1. Dedication
    2. Bruce Perens’ Open Source Series
    3. About the Author
    4. Preface
      1. What This Book Is About
      2. What You Need to Know Before Reading This Book
      3. How This Book Is Laid Out
      4. Conventions Used in This Book
    5. Acknowledgments
    6. 1. Types of Web Pages
      1. 1.1. Static Web Pages
      2. 1.2. Dynamic Web Pages
        1. 1.2.1. HTML
        2. 1.2.2. CSS
        3. 1.2.3. JavaScript
      3. 1.3. Web Browsers
        1. 1.3.1. Microsoft Internet Explorer
        2. 1.3.2. Mozilla-Based Browsers (Netscape, Mozilla, and Firefox)
        3. 1.3.3. Linux Browsers (Konqueror, Ephiphany, Galeon, Opera, and Firefox)
        4. 1.3.4. The Others (Opera, Safari)
      4. 1.4. A Brief Introduction to Cross-Browser Development
        1. 1.4.1. Casualties of the Browser Wars
        2. 1.4.2. Market Share Does Not Equal Right
        3. 1.4.3. The World Wide Web Consortium, Peacekeepers
      5. 1.5. The Server Side of Things
        1. 1.5.1. Apache
        2. 1.5.2. Internet Information Server
        3. 1.5.3. The Remaining Players
      6. 1.6. We Learn by Doing
        1. 1.6.1. Coding by Hand
        2. 1.6.2. Tools to Make Tools
      7. 1.7. Summary
    7. 2. Introducing Ajax
      1. 2.1. Not a Mockup
      2. 2.2. A Technique Without a Name
        1. 2.2.1. Names
      3. 2.3. What Is Ajax?
        1. 2.3.1. The Ajax Philosophy
        2. 2.3.2. Meddling with Unnatural Forces
      4. 2.4. An Ajax Encounter of the First Kind
        1. 2.4.1. A World Unseen
        2. 2.4.2. Enter JavaScript
      5. 2.5. An Ajax Encounter of the Second Kind
        1. 2.5.1. XML
        2. 2.5.2. The XMLHttpRequest Object
      6. 2.6. An Ajax Encounter of the Third Kind
        1. 2.6.1. XSLT
        2. 2.6.2. Variations on a Theme
      7. 2.7. The Shape of Things to Come
      8. 2.8. Summary
    8. 3. HTML/XHTML
      1. 3.1. The Difference Between HTML and XHTML
        1. 3.1.1. Not Well Formed
        2. 3.1.2. Well Formed
        3. 3.1.3. A Well-Formed Example
      2. 3.2. Elements and Attributes
        1. 3.2.1. A Very Brief Overview of XHTML Elements and Their Attributes
        2. 3.2.2. Frames Both Hidden and Visible
        3. 3.2.3. Roll Your Own Elements and Attributes
        4. 3.2.4. A Little CSS
      3. 3.3. Summary
    9. 4. JavaScript
      1. 4.1. Data Types
        1. 4.1.1. Numeric
        2. 4.1.2. String
        3. 4.1.3. Boolean
        4. 4.1.4. Miscellaneous
        5. 4.1.5. Arrays
        6. 4.1.6. Object
      2. 4.2. Variables
      3. 4.3. Operators
      4. 4.4. Flow-Control Statements
        1. 4.4.1. Conditionals
        2. 4.4.2. Looping
      5. 4.5. Functions
      6. 4.6. Recursion
      7. 4.7. Constructors
      8. 4.8. Event Handling
      9. 4.9. Summary
    10. 5. Ajax Using HTML and JavaScript
      1. 5.1. Hidden Frames and iframes
      2. 5.2. Cross-Browser DOM
        1. 5.2.1. JavaScript, ECMAScript, and JScript
        2. 5.2.2. A Problem to Be Solved
      3. 5.3. Tabular Information
        1. 5.3.1. Read Only
        2. 5.3.2. Updateable
      4. 5.4. Forms
        1. 5.4.1. Read Only
        2. 5.4.2. Updateable
      5. 5.5. Advantages and Disadvantages
      6. 5.6. Summary
    11. 6. XML
      1. 6.1. Elements
      2. 6.2. Attributes
      3. 6.3. Handling Verboten Characters
        1. 6.3.1. Entities
        2. 6.3.2. CDATA Sections
      4. 6.4. Comments
      5. 6.5. Expectations
        1. 6.5.1. Namespaces
        2. 6.5.2. DTD
        3. 6.5.3. Schema
      6. 6.6. XML Declaration
      7. 6.7. Processing Instructions
      8. 6.8. XML Data Islands
        1. 6.8.1. Internet Explorer
        2. 6.8.2. Firefox
      9. 6.9. Summary
    12. 7. XMLHttpRequest
      1. 7.1. Synchronous
      2. 7.2. Asynchronous
      3. 7.3. Microsoft Internet Explorer
      4. 7.4. XML Document Object Model
      5. 7.5. RSS
      6. 7.6. Web Services
        1. 7.6.1. What Is a Web Service?
        2. 7.6.2. SOAP
      7. 7.7. Summary
    13. 8. Ajax Using XML and XMLHttpRequest
      1. 8.1. Traditional Versus Ajax Websites
      2. 8.2. XML
        1. 8.2.1. Well Formed
        2. 8.2.2. Data Islands for Internet Explorer
        3. 8.2.3. Data Islands for All!
        4. 8.2.4. Binding
      3. 8.3. The XMLHttpRequest Object
        1. 8.3.1. Avoiding the Unload/Reload Cycle
        2. 8.3.2. Browser Differences
        3. 8.3.3. Cleaning Up with SOAP
      4. 8.4. A Problem Revisited
      5. 8.5. Tabular Information and Forms
        1. 8.5.1. Read Only
        2. 8.5.2. Updateable
      6. 8.6. Advantages and Disadvantages
      7. 8.7. Summary
    14. 9. XPath
      1. 9.1. Location Paths
      2. 9.2. Context Node
      3. 9.3. Parent Nodes
      4. 9.4. Attribute Nodes
      5. 9.5. Predicates
      6. 9.6. XPath Functions
        1. 9.6.1. Boolean Functions
        2. 9.6.2. Numeric Functions
        3. 9.6.3. Node Set Functions
        4. 9.6.4. String Functions
      7. 9.7. XPath Expressions
      8. 9.8. XPath Unions
      9. 9.9. Axis
        1. 9.9.1. Ancestor Axis Example
          1. XPath Statement
          2. Result Node Set
          3. Explanation
        2. 9.9.2. ancestor-or-self Axis Example
          1. XPath Statement
          2. Result Node Set
          3. Explanation
        3. 9.9.3. attribute Axis Example
          1. XPath Statement
          2. Result Node Set
          3. Explanation
        4. 9.9.4. child Axis Example
          1. XPath Statement
          2. Result Node Set
          3. Explanation
        5. 9.9.5. descendant Axis Example
          1. XPath Statement
          2. Result Node Set
          3. Explanation
        6. 9.9.6. descendant-or-self Axis Example
          1. XPath Statement
          2. Result Node Set
          3. Explanation
        7. 9.9.7. following Axis Example
          1. XPath Statement
          2. Result Node Set
          3. Explanation
        8. 9.9.8. following-sibling Axis Example
          1. XPath Statement
          2. Result Node Set
          3. Explanation
        9. 9.9.9. namespace Axis Example
          1. XPath Statement
          2. Result Node Set
          3. Explanation
        10. 9.9.10. parent Axis Example
          1. XPath Statement
          2. Result Node Set
          3. Explanation
        11. 9.9.11. preceding Axis Example
          1. XPath Statement
          2. Result Node Set
          3. Explanation
        12. 9.9.12. preceding-sibling Axis Example
          1. XPath Statement
          2. Result Node Set
          3. Explanation
        13. 9.9.13. self Axis Example
          1. XPath Statement
          2. Result Node Set
          3. Explanation
      10. 9.10. Summary
    15. 10. XSLT
      1. 10.1. Recursive Versus Iterative Style Sheets
        1. 10.1.1. Scope
        2. 10.1.2. Nonvariable Variables
      2. 10.2. XPath in the Style Sheet
      3. 10.3. Elements
        1. 10.3.1. In the Beginning
        2. 10.3.2. Templates and How to Use Them
        3. 10.3.3. Decisions, Decisions
        4. 10.3.4. Sorting Out Looping
      4. 10.4. XSLT Functions
      5. 10.5. XSLT Concepts
      6. 10.6. Client-Side Transformations
        1. 10.6.1. XSLT in Microsoft Internet Explorer
      7. 10.7. Summary
    16. 11. Ajax Using XSLT
      1. 11.1. XSLT
        1. 11.1.1. XML Magic
        2. 11.1.2. How Microsoft Shot Itself in the Foot
        3. 11.1.3. XPath, or I Left It Around Here Someplace
        4. 11.1.4. What I Learned from the Gecko
      2. 11.2. Tabular Information
        1. 11.2.1. Read Only
        2. 11.2.2. Updateable
      3. 11.3. Advantages and Disadvantages
      4. 11.4. Summary
    17. 12. Better Living Through Code Reuse
      1. 12.1. Reuse = Laziness
        1. 12.1.1. Paid by the Line
        2. 12.1.2. Paid by the Page
      2. 12.2. JavaScript Objects
        1. 12.2.1. Collections
        2. 12.2.2. XML
        3. 12.2.3. XSLT
        4. 12.2.4. Serialization Without Berries
      3. 12.3. Generic XSLT
        1. 12.3.1. Forms
        2. 12.3.2. Tabular
      4. 12.4. Summary
    18. 13. Traveling with Ruby on Rails
      1. 13.1. What Is Ruby on Rails?
        1. 13.1.1. Ruby
        2. 13.1.2. Ruby on Rails
      2. 13.2. Installation
      3. 13.3. A Little Ruby on Rails Warm-Up
      4. 13.4. A Problem Revisited
      5. 13.5. Whither Ajax?
      6. 13.6. Summary
    19. 14. Traveling Farther with Ruby
      1. 14.1. Data Types
        1. 14.1.1. Numeric
        2. 14.1.2. String
        3. 14.1.3. Boolean
        4. 14.1.4. Objects
      2. 14.2. Variables
      3. 14.3. Operators
      4. 14.4. Flow-Control Statements
        1. 14.4.1. Conditions
        2. 14.4.2. Looping
      5. 14.5. Threads
      6. 14.6. Ajax
      7. 14.7. Summary
    20. 15. The Essential Cross-Browser HTML DOM
      1. 15.1. Interfaces
        1. 15.1.1. Window
      2. 15.2. Document
      3. 15.3. Frames
      4. 15.4. Collections
      5. 15.5. Summary
    21. 16. Other Items of Interest
      1. 16.1. Sarissa
        1. 16.1.1. A Brief Overview of Sarissa
      2. 16.2. JSON and JSON-RPC
        1. 16.2.1. JavaScript Object Notation
      3. 16.3. ATLAS
        1. 16.3.1. A Picture of ATLAS
      4. 16.4. The World Wide Web Consortium
      5. 16.5. Web Browsers
      6. 16.6. Summary