Ajax by HTML, JavaScript? Technology, DHTML, and DOM make this an excellent way to turn a clumsy Web interface into an interactive Ajax application
a). What does Ajax do?
- Desktop applications: Desktop applications are typically CD-based (sometimes downloadable from a Web site) and fully installed on your computer. Desktop applications may use the Internet to download updates, but the code that runs these applications is on the desktop computer
- Web application: Web applications run somewhere on a Web server--not surprisingly, to access this application through a Web browser.
Desktop applications: typically quickly (running on your computer without waiting for an internet connection), with a nice user interface (usually related to the operating system) and extraordinary dynamics. You can click, select, enter, open menus and submenus, cruise around, and basically don't have to wait.
Web applications are the latest trends that provide services that are not implemented on the desktop (such as Amazon.com and EBay). However, with the powerful Web there is waiting, waiting for the server to respond, waiting for the screen to refresh, waiting for the request to return and generate a new page.
Ajax builds a bridge between the functionality and interactivity of desktop applications and the constantly updated WEB applications. You can use dynamic user interfaces and nice controls that are common in desktop applications, but in WEB applications
(Ajax is an abbreviation for asynchronous JavaScript and XML (as well as DHTML, etc.)
Ajax is a new technique of old technology:
The following are the basic techniques used by AJAX applications:
- HTML is used to establish WEB forms and to determine the fields used by other parts of the application.
- JavaScript code is the core code that runs Ajax applications, helping to improve communication with server applications.
- DHTML or dynamic HTML, which is used to dynamically update the form. We will use
div
, span
and other dynamic HTML elements to tag the HTML.
- The Document Object Model DOM is used (through JavaScript code) to process the HTML structure and (in some cases) the XML returned by the server.
TWO). XMLHttpRequest Object
XMLHttpRequest
。 This is a JavaScript object, which is the object that handles all server traffic. It is simple to create the object, as shown in Listing 1.
Listing 1. Create a new XMLHttpRequest object
<script language= "javascript" type= "Text/javascript" > var xmlHttp = new XMLHttpRequest (); </script>
XMLHttpRequest
It is JavaScript technology that talks to the server through objects. This is not a generic application flow, which is exactly the source of the powerful features of Ajax.
Ajax basically puts JavaScript technology and XMLHttpRequest
objects between Web forms and servers. When a user fills out a form, the data is sent to some JavaScript code instead of being sent directly to the server. Instead, the JavaScript code captures the form data and sends the request to the server. Also, the form on the user's screen does not blink, disappear, or delay. The request is sent asynchronously, meaning that the JavaScript code (and the user) does not wait for the server to respond. So users can continue to enter data, scroll the screen, and use the application .
The server returns the data to the JavaScript code (still in the Web form), which determines how the data is processed. It can quickly update form data, making it feel that the application is done immediately, that the form is not committed or refreshed, and that the user gets new data. JavaScript code can even perform some sort of calculation on the received data and send another request without user intervention at all! This is where XMLHttpRequest
the power is. A dynamic, responsive, highly interactive experience similar to desktop applications, but with all the power of the internet behind it.
Ajax IBM Series one Entry level