Basic AJAX technology

Source: Internet
Author: User

XML-based Asynchronous JavaScript, AJAX for short, is the crown of Web innovation (known as Web2.0. Thanks to the various technologies that make up AJAX, Web application interactions such as Flickr, Backpack, and Google have made a qualitative leap in this regard. This term is derived from the conversion from Web applications based on Web pages to data-based applications. In data-based applications, user-required data, such as the contact list, can be obtained from a server independent of the actual web page and can be dynamically written into the web page, color the slow Web application experience to make it look like a desktop application.
Although most developers have used XMLHttp or Iframe to load data in the past, we have only seen that traditional developers and companies are adopting these technologies. Just as new programming languages or models are accompanied by more pain points, developers need to learn new techniques and how they are best utilized.

AJAX Mode

Many important technologies and AJAX development modes can be obtained from existing knowledge. For example, an application that sends a request to the server must contain the request sequence, priority, timeout response, error processing, and callback. Many of these elements have already been included in the Web service, just like the current SOA. AJAX developers have a complete knowledge of system architecture. At the same time, with the maturity of the technology, there will be many places to improve, especially the usability of the UI part.

AJAX development is very different from traditional CS development. These differences introduce new programming problems, the biggest problem is the ease of use. Because AJAX depends on the JavaScript and XML of the browser, the compatibility and supported standards of the browser become as important as the runtime performance of JavaScript. Most of these problems come from the combination of browsers, servers, and technologies. Therefore, you must understand how to best use these technologies.

AJAX proposes a new development method based on various changing technologies and a strongly coupled client server environment. AJAX developers must understand the traditional MVC Architecture, which limits the boundaries between application layers. At the same time, developers also need to consider the external CS environment and use AJAX technology to redefine the MVC boundary. Most importantly, AJAX developers must disable the use of page collections to consider Web applications and consider them as a single page. Once the scope between the uidesign and the service architecture is strictly differentiated, developers need to update and change the technology set.

Always thinking about users

The biggest opportunity for AJAX is the user experience. In the process of making applications respond quickly and innovate, the rules defining Web applications are being rewritten. Therefore, developers must pay more attention to users. Now users are getting used to how to use Web applications. For example, users usually want to wait several seconds and screen refresh after each button is clicked, but AJAX is breaking this long-time situation. Therefore, the user needs to experience the response of Button clicking again.

Availability is another exciting aspect of AJAX and several novel technologies have been created. One of the most striking technologies is the "Yellow hiding" technology. Before data is updated, the user interface turns yellow, and the original color is restored immediately after the update is completed. AJAX developers free users from the load of Web applications. By carefully using the rich interfaces provided by AJAX, desktop developers will soon find that AJAX is their direction.

Several tools and technologies

With the rapid emergence of AJAX, I think developers are also looking forward to a rapid increase in this technology. Like any new technology, AJAX needs to be supported by an entire development tool/programming language and related technical systems.

JavaScript

As shown in the name, the most important and overlooked concept of AJAX is that it is also a JavaScript programming language. JavaScript is an adhesive that integrates all parts of an AJAX application. Most of the time, JavaScript is often considered by server developers as something that is not needed by enterprise applications. This idea comes from the previous JavaScript coding experience: a complicated and error-prone language. Similarly, it is considered that the application logic is randomly distributed on the server and client, which makes the problem difficult to be discovered and the code is difficult to reuse. In AJAX, JavaScript is mainly used to transmit data on the user interface to the server and return results. The XMLHttpRequest object is used to respond to data transmitted over HTTP. Once the data is returned to the client, the DOM can be used to immediately place the data on the network.

XMLHttpRequest

The XMLHttpRequest object has been implemented in most browsers and has a simple interface that allows data to be transmitted from the client to the server, but does not interrupt the user's current operation. The data transmitted using XMLHttpRequest can be in any format, although the data in XML format is recommended from the name.

Developers should be familiar with many other XML-related technologies. XPath can access data in XML documents, but it is necessary to understand xml dom. Similarly, XSLT is the simplest and fastest way to generate HTML or XML from XML data. Many developers are familiar with Xpath and XSLT, so AJAX chooses XML as a data exchange format that makes sense. XSLT can be used on clients and servers. It can reduce a lot of application logic written in JavaScript.

CSS

To view AJAX applications correctly, CSS is an important weapon for AJAX developers. CSS provides a mechanism for separating application styles and designs from the content. Although CSS plays a vital role in AJAX applications, it is also a major obstacle in building and creating cross-browser applications because different browser vendors support different CSS levels.

Server

However, unlike the client, AJAX applications on the server are still based on the Java,. Net, and PHP languages. The main method in this field is not changed.

In this case, our interest in the Ruby on Rails framework has rapidly increased. More than a year ago, Ruby on Rails attracted a large number of developers to build Web and AJAX applications based on their powerful functions. Although there are still many Rapid Application Development Tools, Ruby on Rails seems to have reserved the ability to simplify the construction of AJAX applications.

Development Tools

In the actual construction of AJAX applications, you need not only a text editor. Since JavaScript is not compiled, it can be easily written and run in a browser; however, many tools provide useful extensions such as syntax highlighting and intelligent completion.

Different ides provide different levels of JavaScript support. IntelliJ IDEA from JetBrains is a better IDE for JavaScript development, although many developers also like Microsoft's Visual Studio (promised to improve AJAX support in the latest version ). Eclipse contains two free JavaScript editor plug-ins and a commercial Komodo IDE from ActiveStat.

Debugging is another problem in JavaScript and AJAX development. Different browsers provide different runtime error messages, while JavaScript defects such as double variable assignment (usually due to lack of data types) Make debugging more difficult. In AJAX development, debugging is more complicated because it needs to identify whether the error is generated by the client or the server. In the past, the JavaScript debugging method was to delete all the code and add a row until the error occurs. Now, more developers return to Microsoft Script Debugger for IE and Venkman for Mozilla Browser.

Browser compatibility

The biggest problem with JavaScript programming comes from the support of various technologies and standards by different browsers. Building a program running on different browsers (such as IE and Firefox) is a difficult task. Therefore, several AJAX JavaScript frameworks can generate JavaScript Based on the server logic or tag library, or provide client JavaScript libraries that comply with cross-browser AJAX development. Some popular frameworks include AJAX. Net, Backbase, Bitkraft, Django, DOJO, DWR, MochiKit, Prototype, Rico, Sajax, Sarissa, and Script. aculo. us.
These frameworks give developers more space to worry about cross-browser issues. Although these frameworks improve the developer's ability to build applications, the vendor has developed a more detailed packaging component solution for the user interface, therefore, some other factors need to be considered in the AJAX component market. For example, components that provide a universal user interface, such as the combo box and data grid, can be used to create a good user experience in applications that allows you to view and edit data in a similar way as a data table. However, these components not only encapsulate the user interface of the component, but also include the communication mode with the server. These components usually implement ASP. Net or JSF controls based on the TAG method.

Outlook

Recently, the competition between IE and Firefox has become so popular that AJAX developers need to be agile enough to respond. Key points are issues such as CSS or XML. Although various browsers form different camps that adopt the latest standards (for example, Mozilla embraces SVG and E4X standards and uses XUL in the latest Firefox BETA version, microsoft uses its own XAML technology ). All these technologies represent changes in the current market direction of mainstream JavaScript and xml ajax.

In general, AJAX developers must follow up on the latest technologies as soon as possible and use highly productive tool sets. Successful AJAX developers also need to pay attention to their users to avoid scaling up any problems. In addition, AJAX developers also need to continuously create new ways to enhance the ease of use of Web applications.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.