Master AJAX, Part 1: Introduction to AJAX

xiaoxiao2021-04-10  518

Brett McLaghlin,

Writer, editor

, O'Reilly and Associates

2006

year

1

month

04

Day Source Url: http://www-128.ibm.com/developerWorks/cn/xml/wa-ajaxintro1.html

Five years ago, if you don't know

Xml

You are a ugly ducklings who are unattended. Eighteen months ago,

Ruby

It became the center of attention, I don't know

Ruby

The programmer can only sit on the cold bench. Today, if you want to keep up with the latest technology, then your goal is

Ajax

.

but,

Ajax

Not only

It is a fashion, it is a powerful way to build a website, and it is not as difficult as learning a new language.

Detailed discussion

Ajax

Before what, let us take a few minutes.

Ajax

do

what. Currently, there are two basic options when writing applications:

Desktop application web application

Both are similar, desktop applications usually

CD

For the media (sometimes downloadable from the website) and fully installed on your computer. Desktop applications may use the Internet to download updates, but run the code for these applications on the desktop computer.

Web

Application is running somewhere

Web

Server

-

Not strange, pass

Web

The browser accesses this application.

However, what is more important than the running code of these applications is how the application is running and how to interact with it. Desktop applications are generally fast (just run on your computer, do not wait for internet access), with beautiful user interfaces (usually related to operating systems) and extraordinary dynamics. You can click, select, Enter, open the menu and submenu, you can patrol everywhere, basically no need to wait.

on the other hand,

Web

The app is the latest trend, which provides services that cannot be implemented on the desktop (for example

Amazon.com

with

eBay

). However, accompanying

Web

The powerful and appearing is waiting, waiting for the server response, waiting for the screen to refresh, wait for the request to return and generate a new page.

Obviously this is too simple, but the basic concept is. You may have already guessed,

Ajax

Try to establish the function and interactivity of desktop applications, with continuously updated

Web

Bridge between the application. You can use dynamic user interfaces and beautiful controls in desktop applications, but it is

Web

In the application.

What are you waiting for? Let's take a look

Ajax

How to get clumsy

Web

Interface transformation into fast response

Ajax

Application.

Old technology, new skill

Talk

Ajax

In actually involving a variety of technologies, it is necessary to flexibly use it necessary to understand these different technologies (including the first few articles of this series will discuss these technologies respectively). Good news is that you may have been very familiar with most of them, and better is that these technologies are easy to learn, unlike complete programming languages ​​(such as

Java

or

Ruby

It is difficult.

Ajax

Definition

By the way,

Ajax

Yes

Asynchronous JavaScript and XML

(as well as

DHTML

Abbreviations. This phrase is

Adaptive path

of

Jesse James Garrett

Invention, according to

Jesse

Explanation, this is not

A first alphabetic word.

Below is

Ajax

Basic techniques used by the application:

HTML is used to establish a web form and determine the fields used in other parts of the application. JavaScript code is the core code of running the AJAX application to help improve communication with the server application. DHTML or Dynamic HTML for dynamic update forms. We will use DIV, SPAN, and other dynamic HTML elements to mark HTML. Document Object Model DOM is used to handle the HTML structure and (in some cases) the XML returned by the HTML structure and (in some cases). Let's further analyze the responsibilities of these technologies. In the future article, I will discuss these technologies in the future, as long as they are familiar with these components and technologies. The more familiar with these codes, the easier, the easier from the zerogenic understanding of these technologies to the truly grasp these techniques (also truly open

Web

The gate of application development).

XMLHTTPREQUEST

Object

An object to be understood may be the most strange to you,

XMLHTTPREQUEST

. This is an

JavaScript

Object, create this object is simple, such as list

1

Indicated.

List

1. Create a new XMLHttpRequest object