Manta alt

YOUR IBM i TRAINING SOURCE

You must allow the browser to execute JavaScript programs if you want to view product information. If your browser is set up to execute JavaScript programs, the problem is that the product ID was incorrect. Use the menu bar above to find the desired product.

Overview

Many organizations now offer web-based applications that rival local applications in their functionality and user interface. Ajax plays a key role in most of these applications. Ajax is not a specific technology as much as a collection of techniques that allows a web developer to dynamically update the currently displayed page with data retrieved from the server. This example-driven course will give you the tools you need to implement your first Ajax application.

The course begins by describing the short history of Ajax and showing examples of the types of things you can do with Ajax, from Google maps to Manta's course presentation system. It then describes the one new technology that makes Ajax possible, JavaScript control of the HTTP request object.

The course then shows multiple, increasingly complex examples of Ajax in action. You will see how to pass parameters to a server and receive data in the form of character strings, HTML fragments, or XML. You will also see how to incorporate data into a web page dynamically, adding elements like tables and pull-down lists that are built from data retrieved from the server. Several special situations are covered, including encoding parameters, passing data as XML, and using XML DOM methods to build HTML elements dynamically.

The course ends with a comprehensive example that uses what you have learned to implement "auto completion" for an input field.

Approximate Study Time: 2 hours

Objectives

After completing this course, you should be able to:

  • Describe the key technologies and techniques that comprise Ajax programming
  • Identify potential Ajax applications
  • Identify the benefits of receiving server data in XML format
  • Order the steps involved in making an Ajax request
  • Code the JavaScript statements to make an Ajax request
  • Identify the methods and properties available with an XMLHttpRequest object
  • Replace the contents of a displayed HTML object
  • Identify the HTML events used to invoke a JavaScript function when a form field has been changed or selected by the user
  • Receive an XML object in an HTTP request
  • Parse an XML object to create HTML
  • Identify the XML methods and properties used to create a new HTML object
  • Describe how frameworks can dramatically reduce the effort required to code an Ajax program
  • Describe the potential role of XSLT in transforming the server response into HTML
  • Identify the changes that must be made to an Ajax program to use POST rather than GET to retrieve data
  • Describe why parameters may need to be encoded before transmission
  • Pass parameters to a server program as XML
  • Describe how to force a browser to make a new server request rather than to use an obsolete page from its cache
  • Code the JavaScript statements and CSS attributes to position an HTML element at a particular location

Topic Outline

Ajax Concepts

Making Server Requests

Retrieving HTML Data

Retrieving XML Data

Handling Input Parameters

An Auto Completion Example

Audience

This course should be taken by individuals responsible for implementing an organization's web site. The audience includes webmasters, content developers, application programmers, and system administrators.

Prerequisites

This course assumes that you understand of the role of HTML, JavaScript, Java servlets, and CGI programs in an ebusiness environment and that you can code HTML/XHTML and basic JavaScript statements. These prerequisites can be satisfied by completing the previous courses of this series:

The course also assumes you know how a CGI program or servlet creates HTML or XML output that is returned to a browser. This prerequisite can be satisfied by completing either of the previous courses of this series:

You may also have obtained these skills by taking other courses (such as the Java Fundamentals series) or through relevant work experience.