Ajax Detailed Introduction

Source: Internet
Author: User

1. What is Ajax and why use Ajax (talk about your understanding of Ajax) What is Ajax:ajax is the abbreviation for "Asynchronous JavaScript and XML". He refers to a web development technique that creates interactive Web applications.
Ajax includes the following techniques: Web-based standard (standards-based presentation) XHTML+CSS representation, dynamic display and interaction using the DOM (Document Object Model), and data using XML and XSLT Exchange and related operations; Use XMLHttpRequest to query and retrieve asynchronous data; Use JavaScript to bind everything together.
The advantages of using the Ajax:ajax application are: 1. With asynchronous mode, the user experience is improved by 2. Optimizes the transfer between browser and server, reduces unnecessary data round-trip, and reduces bandwidth consumption by 3. The Ajax engine runs on the client side, assuming some of the work that would otherwise have been done by the server, thereby reducing the load on the server under a large user volume.

2. What is the biggest feature of Ajax? Ajax can achieve dynamic non-refresh (local refresh) is to be able to not update the entire page without the premise of maintaining data. This allows the Web application to respond more quickly to user actions and avoids sending information that has not changed on the network.

3. Please introduce the XMLHttpRequest object? The core of Ajax is the JavaScript object XMLHttpRequest. This object was first introduced in Internet Explorer 5, which is a technique that supports asynchronous requests. In short, XMLHttpRequest allows you to use JavaScript to make requests to the server and handle the response without blocking the user. With the XMLHttpRequest object, Web developers can make a partial update of the page after the page is loaded.

4. What are the components of the AJAX technology system?
Html,css,dom,xml,xmlhttprequest,javascript

5. What is the difference between AJAX applications and traditional Web applications?
In traditional JavaScript programming, if you want information on a server-side database or file, or send client information to the server, you need to create an HTML form and then get or post data to the server side. Users need to click the "Submit" button to send or receive data information, and then wait for the server to respond to the request, the page reloads. Because the server returns a new page every time, traditional Web applications can be slow and user interaction unfriendly. Using AJAX technology, you can make JavaScript interact directly with the server through XMLHttpRequest objects. With HTTP request, a Web page can send a request to the Web server and accept the information returned by the Web server (without reloading the page), to the user or to a page, the user feels the page is refreshed, and does not see the JavaScript background to send requests and
Accept the response.

6. Total number of AJAX requests callback Ajax requests total eight kinds callback onsuccess onfailure onuninitialized onloading onLoaded oninteractive OnComplete onexception

7. What is the difference between 7.AJAX and JavaScript? JavaScript is a scripting language that executes on the browser side, and Ajax is a development technique for creating interactive Web applications that leverages a range of related technologies including JavaScript. JavaScript is a scripting language developed by Netscape, and it has nothing to do with Sun's Java language, and their similar names are just a marketing strategy. In general Web development, JavaScript is performed on the browser side, and we can use JavaScript to control the browser's behavior and content. How information is passed between the browser and the server in an AJAX application via XML data or a string

8. How to get the server-side response XML data on the browser XMLHttpRequest object's Responsexml property

9. Are there different ways to create XMLHttpRequest objects in IE and Firefox? There, in IE through new ActiveXObject (), Firefox through New XMLHttpRequest () get

10, introduce the common methods and properties of the XMLHttpRequest object (the more answers the better) Open ("Method", "URL") to establish a call to the server, the first parameter is the HTTP request can be a GET, Post or any server that supports the way you want to call. The second parameter is the URL of the requested page.
The Send () method, which sends a specific request to the abort () method, stops the current request for the status of the ReadyState property request with 5 desirable values 0 = uninitialized, 1 = loading 2 = to load, 3 = interactive, 4 = completes the response of the ResponseText property server, expressed as a string Reponsexml the response of the property server, expressed as an HTTP status code for the XML status server, 200 corresponds to OK 400 for not found

Advantages and disadvantages of 11,ajax the greatest advantage of using AJAX is the ability to maintain data without updating the entire page. This allows the Web application to respond more quickly to user actions and avoids sending information that has not changed on the network. The main drawback to applying Ajax is that it can disrupt the normal behavior of the browser Back button because XML is used in Ajax, so it's possible to ask XML questions in Ajax.

12, what is XML XML is an Extensible markup language that can describe data with a series of simple tags

The parsing methods of 13,xml are commonly used in DOM parsing and sax parsing. Dom parsing is a one-time read of an XML file and constructed as a DOM object for the program to use, the advantage is easy to operate, but less memory. Sax is parsed in an event-driven manner and consumes less memory, but programming is complex

14, what frame are you using (Rack package)? This question is a must ask, generally also the beginning will ask. More popular in Java are Dojo, Prototype, JQuery, DWR, ExtJS, etc.

15, if you are familiar with some kind of Ajax framework, he may ask how to use this framework in the Program DWR framework introduction? DWR (Direct Web Remoting) is a Web remote call framework. Using this framework allows AJAX Development has become very simple. Using DWR, you can use JavaScript to call the server-side Java method directly on the client and return the value to JavaScript as if it were a direct local client call (DWR dynamically generates Javascrip code based on the Java class). ? DWR is implemented by reflection, translating Java into JavaScript, and then using a callback mechanism to implement JavaScript calling Java code

16, introduce prototype's $ () function, $F () function, what is the function of the $A () function? The $ () method is a handy shorthand for using an overly frequent document.getElementById () method in the DOM, just like this Dom method, which returns the element of the ID passed in by the parameter. The $F () function is another welcome "shortcut key" that can be used to return the value of any form input control, such as the text Box,drop-down list. This method can also be used as an argument with the element ID or the element itself. The $A () function converts the individual parameters it receives into an array object.


Methods for adding, deleting, moving, copying, and creating nodes in the DOM: AppendChild removechild CloneNode CreateAttribute

The difference between graceful demotion and progressive enhancement:
Elegant downgrade refers to: the first to develop a perfect plan, and then first in the mainstream browser test implementation, and finally in the old version, the less common version of the test implementation, if not fully meet our requirements, then our principle is to achieve as far as possible, if there is no way, it is appropriate to reduce the function, in the process , we may use feature detection (which refers to whether a test browser supports a feature or method);
Progressive enhancement refers to the realization of basic functions in the first place, and then gradually increasing the functionality in future releases, mainly emphasizing the improvement of content.
Elegant downgrade emphasize looking back, asymptotic enhancement refers to looking forward, but both are to ensure that the most basic function to achieve

Ajax Detailed Introduction

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.