SAMS Teach Yourself Ajax in 10 Minutes

Book description

Sams Teach Yourself Ajax in 10 Minutes is a concise introduction to the basics of building Ajax applications and the architecture and operation of these applications. You will learn the techniques employed in using Ajax, introducing Ajax and explaining how it may be used to solve realistic user interface problems. You will be able to immediately begin building web applications, and will have platform from which to explore more advanced aspects of Ajax.

Table of contents

  1. Copyright
    1. Dedication
  2. About the Author
  3. Acknowledgments
  4. We Want to Hear from You!
  5. Reader Services
  6. Introduction
    1. About This Book
    2. What Is Ajax?
    3. Who This Book Is For
    4. What Do I Need To Use This Book?
    5. Conventions Used in This Book
    6. Online Resources and Errata
  7. I. A Refresher on Web Technologies
    1. 1. Anatomy of a Website
      1. A Short History of the Web
      2. Workings of the World Wide Web
        1. What Is a Web Page?
        2. Web Servers
        3. Server-Side Programming
        4. Web Browsers
        5. Client-Side Programming
        6. DNS—The Domain Name Service
      3. Summary
    2. 2. Writing Web Pages in HTML
      1. Introducing HTML
        1. What Is HTML?
        2. What Tools Are Needed to Write HTML?
        3. Our First HTML Document
      2. Elements of an HTML Page
        1. The <head> of the Document
        2. The Document <body>
        3. Adding Attributes to HTML Elements
        4. Images
        5. Tables
        6. Hyperlinks
      3. A More Advanced HTML Page
      4. Some Useful HTML Tags
      5. Cascading Style Sheets in Two Minutes
        1. Setting Style Sheet Rules
      6. Summary
    3. 3. Sending Requests Using HTTP
      1. Introducing HTTP
        1. Why Do I Need To Know About This?
        2. What Is (and Isn’t) Covered in This Lesson
      2. The HTTP Request and Response
        1. The HTTP Request
        2. The HTTP Response
      3. HTML Forms
        1. GET and POST Requests
      4. Summary
    4. 4. Client-Side Coding Using JavaScript
      1. About JavaScript
        1. Why Do I Need To Know About JavaScript?
        2. What Is (and Isn’t) Covered in This Lesson
        3. JavaScript Basics
      2. In at the Deep End
        1. Including JavaScript in HTML Pages
        2. Event Handlers
        3. Creating Functions
        4. Passing Arguments to Functions
        5. Other Event Handlers
      3. Manipulating Data in JavaScript
        1. Variables
        2. Objects
        3. Example—Form Validation
      4. Summary
    5. 5. Server-Side Programming in PHP
      1. Introducing PHP
        1. Why Do I Need To Know This?
        2. What Is (and Isn’t) Covered in This Lesson
      2. Embedding PHP in HTML Pages
        1. Outputting HTML from PHP
      3. Variables in PHP
        1. Numbers
        2. Strings
        3. Arrays
      4. Controlling Program Flow
      5. Summary
    6. 6. A Brief Introduction to XML
      1. Introducing XML
        1. Why Do I Need To Know This?
        2. What Is (and Isn’t) Covered in This Lesson
      2. XML Basics
        1. XML Document Structure
        2. Document Prolog
        3. Document Type Declaration
        4. Element Declarations
        5. Attribute List Declarations
        6. Valid XML
      3. JavaScript and XML
      4. The Document Object Model (DOM)
        1. Nodes
        2. Getting Tagnames
        3. Getting Element Attributes
        4. Tag Contents
      5. Summary
  8. II. Introducing Ajax
    1. 7. Anatomy of an Ajax Application
      1. The Need for Ajax
        1. Traditional Versus Ajax Client-Server Interactions
        2. The Rich User Experience
      2. Introducing Ajax
        1. A Real Ajax Application—Google Suggest
      3. The Constituent Parts of Ajax
        1. The XMLHTTPRequest Object
        2. Talking with the Server
        3. What Happens at the Server?
        4. Dealing with the Server Response
        5. Other Housekeeping Tasks
      4. Putting It All Together
      5. Summary
    2. 8. The XMLHTTPRequest Object
      1. More About JavaScript Objects
        1. Creating an Instance of an Object
        2. The Document Object Model or DOM
      2. Introducing XMLHTTPRequest
      3. Creating the XMLHTTPRequest Object
        1. Different Rules for Different Browsers
        2. A Solution for All Browsers
        3. Methods and Properties
        4. The open() Method
        5. The send() Method
      4. Summary
    3. 9. Talking with the Server
      1. Sending the Server Request
        1. Dealing with the Browser Cache
      2. Monitoring Server Status
        1. The readyState Property
        2. Server Response Status Codes
      3. The Callback Function
        1. Using the Callback Function
      4. Summary
    4. 10. Using the Returned Data
      1. The responseText and responseXML Properties
        1. The responseText Property
        2. The responseXML Property
      2. Another Useful JavaScript DOM Property
        1. The getElementsByTagName() Method
      3. Parsing responseXML
      4. Providing User Feedback
        1. The getElementById() Method
      5. Summary
    5. 11. Our First Ajax Application
      1. Constructing the Ajax Application
      2. The HTML Document
      3. Adding JavaScript
        1. The XMLHTTPRequest Object
        2. The Server Request
        3. Our PHP Server-Side Script
        4. The Callback Function
        5. Employing Event Handlers
      4. Putting It All Together
        1. User Feedback
      5. Summary
  9. III. More Complex Ajax Technologies
    1. 12. Returning Data as Text
      1. Getting More from the responseText Property
        1. Returning Text
        2. Using Returned Text Directly in Page Elements
        3. Including HTML in responseText
        4. More Complex Formatted Data
      2. Summary
    2. 13. AHAH—Asynchronous HTML and HTTP
      1. Introducing AHAH
        1. Why Use AHAH Instead of Ajax?
      2. Creating a Small Library for AHAH
        1. Introducing myAHAHlib.js
      3. Using myAHAHlib.js
        1. Applying myAHAHlib.js in a Project
        2. Extending myAHAHlib.js
      4. Summary
    3. 14. Returning Data as XML
      1. Adding the “x” to Ajax
      2. The responseXML Property
        1. More JavaScript DOM Methods
        2. An Overview of DOM Methods
      3. Project—An RSS Headline Reader
        1. The HTML Page for Our Application
        2. The Code in Full
        3. The Callback Function
        4. The Server-Side Code
      4. Summary
    4. 15. Web Services and the REST Protocol
      1. Introduction to Web Services
      2. REST—Representational State Transfer
        1. A Hypothetical REST Example
        2. Query Information Using GET
        3. Stateless Operation
      3. Using REST in Practice
        1. Reading a List of Available Articles
        2. Retrieving a Particular Article
        3. Uploading a New Article
        4. Real World REST—the Amazon REST API
      4. REST and Ajax
      5. Summary
    5. 16. Web Services Using SOAP
      1. Introducing SOAP (Simple Object Access Protocol)
        1. The Background of the SOAP Protocol
      2. The SOAP Protocol
        1. Code Example of a SOAP Request
        2. Sending the SOAP Request Via HTTP
      3. Using Ajax and SOAP
        1. Code Example
      4. Reviewing SOAP and REST
      5. Summary
    6. 17. A JavaScript Library for Ajax
      1. An Ajax Library
      2. Reviewing myAHAHlib.js
      3. Implementing Our Library
        1. Creating XMLHTTPRequest Instances
        2. HTTP GET and POST Requests
        3. The Callback Function
      4. Using the Library
      5. Extending the Library
      6. Summary
    7. 18. Ajax “Gotchas”
      1. Common Ajax Errors
      2. The Back Button
      3. Bookmarking and Links
      4. Telling the User That Something Is Happening
      5. Making Ajax Degrade Elegantly
      6. Dealing with Search Engine Spiders
      7. Pointing Out Active Page Elements
      8. Don’t Use Ajax Where It’s Inappropriate
      9. Security
      10. Test Code Across Multiple Platforms
      11. Ajax Won’t Cure a Bad Design
      12. Some Programming Gotchas
        1. Browser Caching of GET Requests
        2. Permission Denied Errors
        3. Escaping Content
      13. Summary
  10. IV. Commercial and Open Source Ajax Resources
    1. 19. The prototype.js Toolkit
      1. Introducing prototype.js
        1. The $() Function
        2. The $F() Function
        3. The Form Object
        4. The Try.these() Function
      2. Wrapping XMLHTTPRequest—the Ajax Object
        1. Ajax.Request
        2. Ajax.Updater
        3. Ajax.PeriodicalUpdater
      3. Example Project—Stock Price Reader
      4. Summary
    2. 20. Using Rico
      1. Introducing Rico
        1. Using Rico in Your Applications
        2. Rico’s AjaxEngine
        3. A Simple Example
      2. Rico’s Other Interface Tools
        1. Drag-and-Drop
        2. Example of a Drag-and-Drop Interface
        3. Cinematic Effects
      3. Summary
    3. 21. Using XOAD
      1. Introducing XOAD
        1. Downloading and Installing XOAD
        2. A Simple XOAD Page
      2. XOAD HTML
        1. XOAD_HTML::getElementById()
        2. XOAD_HTML::getElementsByTagName()
      3. Advanced Programming with XOAD
        1. XOAD Events
        2. Cache Handling with XOAD
        3. XOAD Controls
      4. Summary

Product information

  • Title: SAMS Teach Yourself Ajax in 10 Minutes
  • Author(s):
  • Release date: April 2006
  • Publisher(s): Sams
  • ISBN: 9780672328688