Ajax-driven Web sites

Source: Internet
Author: User
Tags object command line error handling execution net client
ajax|web| site recently, many Web sites began to attract attention in the developer community. The uniqueness of these sites is that they are more like desktop applications than Web applications. When you interact with them, they can quickly display infinite information in the browser without reloading the page.

For example, at the Google Maps site (http://maps.google.com/), you can click the map, zoom out or zoom in, and move the mouse back and forth as you like. The browser reads data from the server sequentially, but does not need to refresh the browser. They are not using applets or other programs like Flash. So, how do they work?

The following describes asynchronous JavaScript + XML, known as Ajax. The easiest way to describe exactly what Ajax is is to compare it to the opposite. For most Web sites, interacting with a Web server is the easiest way to communicate-just as you would chat with a friend on a walkie-talkie (walkie-talkie). You can talk to him on the other side, or he says you answer, but you can't answer and talk at the same time. For web users, when the online form is filled out and the Submit button is clicked, the entire page is sent to the Web server, and the user must wait for the server to accept the request. When the server finishes processing the request, it sends over the processed content. Only then can the user page be refreshed eventually. Ajax is an attempt to reduce this series of events. When a user is in an AJAX-type web site, the browser can asynchronously invoke the Web server behind the scenes without sending the entire page.

Specific content

Typically, Ajax does not have a software development kit (SDK). It's not something you can download. Although XML appears in the Ajax name, it is actually a combination of several that can be used without even using XML technology. With a closer look, we will find that it is a mixture of several technologies that are being used. JavaScript, DOM, XMLHTTP, and XML are the primary roles. But it is important to note that this methodology is neither standard nor strictly defined. What you see in an execution program may be different from the situation in the other execution program. However, the most common of Ajax execution programs is JavaScript.

JavaScript code handles various events when the user interacts with the browser. such as keystrokes or click events, and will be processed accordingly. JavaScript uses the XMLHttpRequest object as a connection between the browser and the remote server. Microsoft first adopted the XMLHttpRequest object in Internet Explorer 5.

The coolest thing about a Xmlhttp-request object is that it can be run in the background while talking to the Web server asynchronously without reloading the page. When the Web server receives a request from the browser, it processes and returns the processed XML data to the browser. The JavaScript engine receives this processed XML data and then uses the DOM to process the corresponding page part. For example, in an AJAX-driven page, such as the Google suggest site (www.google.com/webhp?complete=1&hl=en), when you enter a search field, each letter is sent asynchronously to the server. As you enter, the content is displayed quickly below the body of the text. Behind the scenes, each key will be called several times to the server. The user is not affected by this because the interaction is not aborted. Only a subset of the pages will be refreshed. This can be done efficiently because only a portion of the page data, rather than the entire page data, is sent through the cable.

Ajax is not a newborn thing

It should be noted that Ajax is not a novelty. The methodology has been in use for many years. Web sites, such as Google, are proving the validity and stability of Ajax, and making the web look more like a desktop application: The real meaning of web development. The special thing about Ajax is that it can be done by using validated existing technologies. In other words, any standard browser (a browser that can handle JavaScript and DOM) can work correctly. You do not need to install additional plug-ins separately.

In Magenic, we can see how this methodology benefits our clients. As far as we know, Ajax is not a substitute for all Web sites, but it should have a place in the computer instruction system and a skill we need.

asp.net 2.0

ASP.net 2.0 can significantly improve the scripting model combined with this methodology. They are called script callbacks, not Ajax. In fact, they work as I described earlier, but ASP.net 2.0 makes it a step further by providing tools and support.

Attention matters

1. Because much of the work has to be handed over to client processing, Ajax can affect the command line between the correct stacking technology. This should be noted when designing such applications using the existing methodology. The client (browser) needs to handle more work, and JavaScript is quite complex to do this. It needs to handle keystrokes, mice, interact with the DOM, handle these events, and coordinate server data.

2, it should also be noted that many users may not want to run JavaScript on the browser. You need to consider the needs of your Web site users.

3, Ajax name and informal. Adaptive Path's staff made this easy to remember name. In ASP.net 2.0, it is also referred to as a "script callback."

    • Ajax: A new way to build Web apps
    • Discussion on the error handling mechanism of AJAX (2)
    • Discussion on the error handling mechanism of AJAX (1)
    • First experience. NET Ajax Brushless New technology
    • A brief analysis of Ajax development Technology in Rails system (4)


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.