A brief analysis of Ajax controls and class libraries

Source: Internet
Author: User
Tags object html tags net object model return client
Ajax| Control

AJAX controls and class libraries are now really too many, unknowingly added to the mystery of Ajax and complexity, to talk about my view of Ajax, I hope to let you have an understanding of Ajax.

Point one: Ajax and server-side technology are irrelevant

Strictly speaking, Ajax is completely client-side technology compared with traditional web development. Because many controls encapsulate the client and server-side communication processes, many problems also result from communication. In fact, no matter what AJAX technology, the server side is the return of a plain text stream, and then the client to process the text. This text can be an XML format, an HTML fragment, a JavaScript script, or just a string. The server side is just as a data interface, the client uses the XMLHttpRequest object to request this page, the server side writes the result text inside the page, this process and the ordinary Web development does not have any difference. The difference is that, after the client obtains the result asynchronously, it is not displayed directly on the page, but is processed by the client's JavaScript script and then displayed on the page. As for the various controls called the ability to return dataset objects, date objects, or other data types, they encapsulate the results of this process.

Point two: Dom model is the most essential technology of Ajax

The reason why XMLHttpRequest is not listed as the most essential technology, because I think it is too simple, it can only let the browser in the background to request a page, and its content to JavaScript processing. The real core should be: The DOM model, the Document Object model. In the DOM model, HTML tags are considered an object, such as a Div object, a Table object, and so on. The DOM model prescribes the properties, methods, and events that these objects have. With these properties, you can modify the content of a page that is already displayed in the browser, such as adding nodes, modifying node locations, deleting nodes, and so on. It's not just a innerHTML attribute, although it's a useful property.

Point three: Understand the implementation of Ajax controls before using them

Using AJAX controls can improve efficiency, but if you use controls in a castle, that's not worth the candle. Swapping from one control to another has a long learning curve. So it should be understood from the bottom, and Ajax is not a sophisticated technology. In fact, the bottom of anything is actually simple, but if you encapsulate these low-level things, things will become complex and difficult to understand. In the case of ASP.net, its custom features can be called an asynchronous method by adding a flag such as "Ajax method" before the approach, which makes ASP.net's Ajax development seem more "efficient" or "mysterious", and more things are encapsulated. Also remember that any request to the server is simply a return to plain text, and we do not have to rely on the encapsulated process to be fully implemented by ourselves.

Point four: Learn JavaScript

In most people's view, JavaScript is not such a formal language, just copy a paragraph happens to be able to run, have learned C such people, a look also can understand, and in the browser often have script error prompts, so the subconscious feel always can't pay for the big. In fact, to learn Ajax well, this is a completely erroneous view. JavaScript, as a scripting language, does not have strict syntax, but does not prevent it from accomplishing many complex tasks, without JavaScript, there is no Ajax. Therefore, I strongly suggest that learning Ajax before, we must study a good JavaScript, generally speaking, if you can understand the prototype framework of the code (such as: Prototype-1.3.1.js), your JavaScript level basic clearance. It is also possible to have a basic understanding of the DOM model.

Point five: Ajax embellishment: CSS

Using JavaScript to control CSS is actually very simple, basically each DOM object has a style object, as long as the CSS properties of the "-" removed, and the subsequent letters into uppercase can be used as a property, For example: element.style.backgroundcolor= "#f00"; in CSS is: selector {background-color: #f00}



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.