Ajax For Dummies®

Book description

Ajax is short for “Asynchronous JavaScript+CSS+DOM+XMLHttpRequest.”

Even if you weren’t intimidated before, that tidbit is probably enough to make you reach for the Excedrin. Just reach for Ajax For Dummies instead. With screen shots, actual code and explanations, and live Web sites where you can see Ajax applications doing their thing, it will have you using Ajax to create Web applications that look an act like desktop applications in no time. With Ajax, you can speed up and clean up your Web applications. Shoppers at your online store can fill their carts without waiting for multiple page refreshes. Searchers on your sites can get instant results on the same page.

This guide takes you on a tour of how Ajax is used today, complete with examples of Ajax applications in action, such as an Ajax-enabled Yahoo! search or an Ajax-based chat application. Then it gives you basics on using JavaScript. After that you dive in and get info on:

  • Writing some Ajax, interactive mouseovers using Ajax, passing data to the server with GET or POST, and more

  • Connecting to Google for a live search

  • Using free Ajax frameworks so you don’t have to start from scratch, including Ajax Gold (written specifically for this book), AJAXLib, and grabbing XML with libXmlRequest

  • All kinds of Ajax techniques, such as using Ajax for drag-and-drop operations, pop-up menus, downloading images behind the scenes, and more

  • Using SACK (simple AJAX code kit), decoding XML with Sarissa, and creating visual effects with Rico

  • Handling XML int Ajax Applications

  • Working with cascading style sheets (CCS) in Ajax, including setting up the styles, displaying a menu, styling text, handling colors and backgrounds, and more

  • Working with Ajax and PHP

Complete with a companion Web site, free Ajax frameworks, and sample code you can use, Ajax for Dummies is your friendly guide to creating truly user-friendly Web sites!

Note: CD-ROM/DVD and other supplementary materials are not included as part of eBook file.

Table of contents

  1. Copyright
    1. Dedication
  2. About the Author
  3. Publisher’s Acknowledgments
  4. Introduction
    1. About This Book
    2. Conventions Used in This Book
    3. Foolish Assumptions
    4. How This Book Is Organized
      1. Part I: Getting Started
      2. Part II: Programming in Ajax
      3. Part III: Ajax Frameworks
      4. Part IV: In-Depth Ajax Power
      5. Part V: The Part of Tens
    5. Icons Used in This Book
    6. Where to Go from Here
  5. I. Getting Started
    1. 1. Ajax 101
      1. How Does Ajax Work?
        1. A user’s perspective
        2. A developer’s perspective
      2. What Can You Do with Ajax?
        1. Searching in real time with live searches
        2. Getting the answer with autocomplete
        3. Chatting with friends
        4. Dragging and dropping with Ajax
        5. Gaming with Ajax
        6. Getting instant login feedback
        7. Ajax-enabled pop-up menus
        8. Modifying Web pages on the fly
        9. Google Maps and Ajax
      3. When Is Ajax a Good Choice?
    2. 2. It’s All About JavaScript
      1. Taking a First Look at Ajax in Action
        1. Taking a look at the code
        2. Delving deeper into JavaScript
      2. Enter JavaScript
        1. Creating a script
        2. Accessing the Web page from JavaScript
        3. Oh, those semicolons
        4. Adding comments to your JavaScript
        5. Using separate script files
        6. Examining script errors
        7. Which browser are you using?
      3. Making Something Happen: Browser Events
        1. Putting browser events to work
        2. Getting the quotation marks right
      4. Dividing and Conquering: JavaScript Functions
        1. Understanding the problem
        2. Putting together a function
        3. Calling the function
        4. Passing a single argument to a function
        5. Using <div> versus <span>
        6. Passing multiple arguments
      5. You Must Remember This: Storing Data
        1. Simple data storage with the var statement
        2. Churning your data with operators
        3. Altering a variable’s data
        4. Storing JavaScript objects in a variable
        5. Oh, those functions!
      6. Picking and Choosing with the if Statement
        1. Using the if statement
        2. Using the else statement
        3. Determining browser type and version
      7. It Just Gets Better: The for Loop
      8. Over and Over with the while Loop!
      9. Pushing Some Buttons
        1. Displaying a message with a button click
        2. Reading a text field with a button click
  6. II. Programming in Ajax
    1. 3. Getting to Know Ajax
      1. Writing Some Ajax
        1. Creating the XMLHttpRequest object
        2. Checking to make sure you have a valid XMLHttpRequest object
        3. Opening the XMLHttpRequest object
        4. When you’re ready: Handling asynchronous downloads
        5. You got the data!
        6. Deciding on relative versus absolute URLs
        7. Other ways of getting XMLHttpRequest objects
      2. Interactive Mouseovers Using Ajax
      3. Getting Interactive with Server-Side Scripting
        1. Choosing a server-side scripting language
        2. Connecting to a script on a server
      4. Time for Some XML
        1. Getting XML from a PHP script
        2. Setting up a Web page to read XML
        3. Handling the XML you read from the server
        4. Extracting data from XML
        5. Listing the colors in the drop-down control
      5. Passing Data to the Server with GET
      6. Passing Data to the Server with POST
    2. 4. Ajax in Depth
      1. Returning JavaScript from the Server
        1. When do you send back JavaScript from the server?
        2. How does returning JavaScript work?
        3. Returning a JavaScript object
      2. Connecting to Google for a Live Search
        1. Handling the data Google sends you
        2. Detecting keystrokes
        3. Connecting to Google Suggest
        4. Showing Google’s response
      3. Calling a Different Domain
      4. Reversing the Roles: Performing Validation on the Server
      5. Getting Some Amazing Data with HEAD Requests
        1. Returning all the header data you can get
        2. Finding the last-modified date
        3. Does a URL exist?
      6. Finding the Problem: Debugging Ajax
        1. Setting up your browser for debugging
        2. Debugging with Greasemonkey
      7. Overload: Handling Multiple Concurrent Requests
        1. Double the fun
        2. Packing it all into an array
        3. Getting the inside scoop on inner functions
  7. III. Ajax Frameworks
    1. 5. Introducing Ajax Frameworks
      1. A Little More Ajax Power
      2. Introducing the Ajax Gold Framework
        1. Using GET to get text
        2. Using GET to get XML
        3. Using POST to post data and get text
        4. Using POST to post data and get XML
      3. Finding Ajax Frameworks in the Wild
        1. Easy Ajax with AJAXLib
        2. Grabbing XML with libXmlRequest
    2. 6. More Powerful Ajax Frameworks
      1. Dragging and Dropping with Shopping Carts
        1. Handling mouse events
        2. Handling mouse down events
        3. Handling mouse-move events
        4. Handling mouse up events
        5. Updating the shopping cart
      2. Looking at Some Heavier-Weight Frameworks
        1. Getting XMLHttpRequest objects with XHConn
        2. The Simple AJAX Code Kit: Sack
        3. Parsing XML with Interactive Website Framework
        4. Handling older browsers with HTMLHttpRequest
        5. Decoding XML with Sarissa
        6. Creating visual effects with Rico
          1. Displaying data in an HTML element
          2. Letting JavaScript objects handle your data
        7. Overcoming caching with the Http framework
    3. 7. Server-Side Ajax Frameworks
      1. Writing JavaScript by Using Ajax Frameworks
        1. Sajax and PHP
        2. Xajax and PHP
        3. LibAjax and PHP
        4. JPSpan and PHP
      2. Accessing Java with Direct Web Remoting
        1. Setting up for Java on the Web
        2. Connecting to Java by using DWR
      3. Building Web Applications with Echo2
      4. Handling Ajax and JavaServer Pages with Ajax Tags
      5. Handling Java with SWATO
      6. Tracking Down the Many Other Frameworks Available
        1. Developing amazing applications with WebORB
        2. Ruby on Rails
        3. Backbase
        4. Dojo
        5. Atlas.NET
  8. IV. In-Depth Ajax Power
    1. 8. Handling XML in Ajax Applications
      1. Understanding Basic XML
        1. What’s in a tag?
        2. Keeping XML documents well-formed
        3. Making an XML document valid
      2. Requesting XML Data in Ajax
      3. Extracting XML Data Using Properties
        1. Right on the node
        2. Introducing the JavaScript properties
        3. Navigating an XML document using JavaScript properties
        4. Extracting with nodeValue
        5. Handling white space in Mozilla and Firefox
        6. Removing white space in Mozilla and Firefox
      4. Accessing XML Elements by Name
      5. Accessing Attribute Values in XML Elements
      6. Validating XML Documents in Ajax Applications
    2. 9. Working with Cascading Style Sheets in Ajax Applications
      1. An Ajax-Driven Menu System
        1. Setting up the styles
        2. Handling mouse events
        3. Displaying a menu
        4. Hiding a menu
        5. Getting a menu’s item from the server
        6. Handling the menu items
      2. Displaying Text That Gets Noticed
        1. Styling text
        2. Handling colors and backgrounds
        3. Positioning using styles
          1. Absolute positioning
          2. Relative positioning
    3. 10. Working with Ajax and PHP
      1. Starting with PHP
      2. Getting a Handle on Variables
      3. Handling Your Data with Operators
      4. Making Choices with the if Statement
      5. Round and Round with Loops
      6. Handling HTML Controls
        1. Getting data from text fields
        2. Checking out data from check boxes
        3. Tuning in data from radio buttons
      7. Sending Data to the Server
      8. Reading Files
      9. Writing Files
      10. Working with Databases
  9. V. The Part of Tens
    1. 11. Ten Ajax Design Issues You Should Know About
      1. Breaking the Back Button and Bookmarks
      2. Giving Visual Cues
      3. Leaving the User in Control
      4. Remembering All the Different Browsers
      5. Showing Users When Text Changes
      6. Avoiding a Sluggish Browser
      7. Handling Sensitive Data
      8. Creating a Backup Plan
      9. Showing Up in Search Engines
      10. Sidestepping a Browser’s Cache
    2. 12. Ten Super-Useful Ajax Resources
      1. The Original Ajax Page
      2. The Ajax Patterns Page
      3. The Wikipedia Ajax Page
      4. Ajax Matters
      5. XMLHttpRequest Object References
      6. Ajax Blogs
      7. Ajax Examples
      8. Ajax Tutorials
      9. Ajax Discussion Group
      10. More Depth on XMLHttpRequest
  10. Ajax For Dummies®
    1. Configuring an XMLHttpRequest object
    2. Fetching your data
    3. Creating an XMLHttpRequest object
    4. Setting up the callback function
    5. Important XMLHttpRequest object properties
    6. Important XMLHttpRequest object methods
    7. The readyState values
    8. The Ajax Gold framework functions
    9. Important status values

Product information

  • Title: Ajax For Dummies®
  • Author(s):
  • Release date: March 2006
  • Publisher(s): Wiley
  • ISBN: 9780471785972