search
HomeWeb Front-endJS Tutorial19 classic ajax interview questions

19 classic ajax interview questions

Jul 31, 2020 am 11:43 AM
ajax interview questions

19 classic ajax interview questions

19 classic interview questions for ajax

1. What is AJAX and why should we use Ajax (Please talk about your understanding of Ajax)
What is ajax:
AJAX is the abbreviation of "Asynchronous JavaScript and XML". It refers to a web development technology for creating interactive web applications.
Ajax includes the following technologies:
Based on web standards (standards-basedpresentation) XHTML CSS representation;
Use DOM (Document Object Model) for dynamic display and interaction;
Use XML and XSLT for data exchange and Related operations;
Use XMLHttpRequest for asynchronous data query and retrieval;
Use JavaScript to bind everything together.

[Topic recommendation]:2020 ajax interview questions and answers (latest)

2. Why use ajax:
The advantages of Ajax applications are:
1. Improve the user experience through asynchronous mode
2. Optimize the transmission between the browser and the server, reduce unnecessary data round-trips, and reduce bandwidth usage
3. The Ajax engine runs on the client and takes on part of the work originally performed by the server, thus reducing the server load under large user volumes.
2. What is the biggest feature of AJAX.
Ajax can achieve dynamic non-refresh (partial refresh)
That is, it can maintain data without updating the entire page. This allows web applications to respond more quickly to user actions and avoids sending unchanged information over 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 and is a technology that supports asynchronous requests. In short, XmlHttpRequest allows you to use JavaScript to make requests to the server and handle the responses without blocking the user. Through the XMLHttpRequest object, web developers can perform partial updates to 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 to get information from 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 the data to the server. Users need to click the "Submit" button to send or receive data information, and then wait for the server to respond to the request and the page to reload.
Because the server returns a new page every time, traditional web applications may be slow and user-unfriendly.
Using AJAX technology, Javascript can interact directly with the server through the XMLHttpRequest object.
Through 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). What is displayed to the user is still the same page. The user feels that the page is refreshed and cannot see it. Javascript sends requests and receives responses in the background.

6. How many types of CALLBACK are there in AJAX requests?
Ajax requests have a total of eight Callbacks
onSuccess<br>onFailure<br>onUninitialized<br>onLoading<br>onLoaded<br>onInteractive<br>onComplete<br>onException

7. The difference between Ajax and javascript.
Javascript is a scripting language that is executed on the browser side. Ajax is a development technology for creating interactive web applications. It uses a series of related technologies, including javascript.
Javascript is a scripting language developed by Netscape. It has nothing to do with Sun's Java language. Their similar names are just a marketing strategy.
In general web development, javascript is executed on the browser side. We can use javascript to control the behavior and content of the browser.
How information is transferred between the browser and the server in Ajax applications
Through XML data or strings

8. How to get the server-side response XML on the browser side data.

The responseXMl attribute of the XMLHttpRequest object


9. Is there any difference in how XMLHttpRequest objects are created in IE and Firefox.

Yes, it is obtained through new ActiveXObject() in IE, and it is obtained through newXMLHttpRequest() in Firefox

10. Introduce the common methods and properties of XMLHttpRequest object.
open("method","URL") establishes a call to the server. The first parameter is an HTTP request. The method can be GET, POST or any method you want to call supported by the server.
The second parameter is the URL of the requested page.
send() method, send a specific request
abort() method, stop the current request
readyState attribute The status of the request has 5 possible values ​​0=not initialized, 1=loading
2= Loading, 3=interaction, 4=complete
responseText attribute The server's response, expressed as a string
responseXML attribute The server's response, expressed as XML
status The server's HTTP status code, 200 corresponds to ok 400 Corresponding to not found

11. What is XML
XML is an extended markup language that can describe data with a series of simple tags

12. XML The parsing methods
are commonly used to use dom parsing and sax parsing. DOM parsing is to read the XML file at one time and construct it into a DOM object for use by the program. The advantage is that it is easy to operate, but it consumes more memory. Sax is parsed in an event-driven manner, which takes up less memory, but is complicated to program.

13. What framework (package) are you using?
This question is a must-ask , is usually asked at the very beginning.
The more popular ones in java are dojo, Prototype, JQuery, Dwr, extjs, etc.

14. If you are familiar with a certain ajax framework, he may ask how to use it in the program. Kind of framework
DWR framework introduction
DWR (DirectWeb Remoting) is a WEB remote calling framework. Using this framework can make AJAX development very simple. Using DWR, you can use JavaScript on the client to directly call the server Java methods and return values ​​to JavaScript are just like direct local client calls (DWR dynamically generates JavaScript code based on Java classes).
The implementation principle of DWR is to translate java into javascript through reflection, and then use the callback mechanism, thus Implemented javascript calling Java code

15、介绍一下Prototype的()">()">()()">()">#,#() function, F() function, A()">A() functionnumberall iswhat #What does the A() function do? () The method is in A convenient shorthand for the too-often used document.getElementById() method in DOM. Like this DOM method, this method returns the element with the id passed in as the parameter. The $F() function is another popular "shortcut key" that can be used to return the value of any form input control, such as textbox, drop-down list. This method can also take an element id or the element itself as a parameter.

$A() function can convert the single parameter it receives into an Array object.

()">()">A()">
16. Introduce the XMLHttpRequest object
Through the XMLHttpRequest object, web developers can modify the page after the page is loaded. local update.
AJAX became popular when Google used "Google Suggest" in 2005.
"Google Suggest" uses the XMLHttpRequest object to create a dynamic Web interface:
When the user starts typing in Google's search box, Javascript sends the characters entered by the user to the server, and then the server returns a list of suggestions.

The XMLHttpRequest object is supported in IE5.0, Safari 1.2, Mozilla1.0/Firefox, Opera 8 and NetScapt7.

()">()">A()">
17. What is the full name of AJAX? Introduce AJAX?
The full name of AJAX is Asynchronous JavaScript And XML.
AJAX is a programming method initiated by Google in 2005 and became popular. AJAX is not a new programming language, but it is a new programming language that uses existing standards. programming technology.
Use AJAX to create better, faster, and more user-friendly web applications.

AJAX technology is based on Javascript and HTTP Request.

()">()">A()">
18. What technologies does Ajax mainly include?
Definition of Ajax (Asynchronous JavaScript XML)
Based on web standards (standards-based presentation) XHTML CSS representation;
Use DOM (Document Object Model) for dynamic display and interaction;
Use XML and XSLT for data exchange and related operations;
Use XMLHttpRequest for asynchronous data query and retrieval;
Use JavaScript to bind everything together. In English, please see the original text by Jesse James Garrett, the proposer of Ajax, and the original title (Ajax: A New Approach to Web Applications).
Similar to DHTML or LAMP, AJAX does not refer to a single technology, but organically utilizes a series of related technologies. In fact, some "derivative/composite" technologies based on AJAX are emerging, such as "AFLAX".

AJAX applications use web browsers that support the above technologies as the running platform. These browsers currently include: Mozilla, Firefox, Internet Explorer, Opera, Konqueror and Safari. But Opera does not support XSL format objects, nor does it support XSLT.

()">A()">
#19. What are the advantages and disadvantages of AJAX?
1. The biggest point is that the page does not refresh, and the user experience is very good.
2. Use asynchronous mode to communicate with the server, with faster response capability.
3. Some of the work previously burdened by the server can be transferred to the client, using the idle capacity of the client to process it, reducing the burden on the server and bandwidth, and saving space and broadband rental costs. And to reduce the burden on the server, the principle of ajax is to "fetch data on demand", which can minimize the burden on the server caused by redundant requests and responses.
4. Based on standardized and widely supported technology, there is no need to download plug-ins or small programs.

Disadvantages of ajax
1. Ajax does not support the browser back button.
2. Security issues AJAX exposes the details of interaction with the server.
3. The support for search engines is relatively weak.
4. Destroyed the exception mechanism of the program.
5. Not easy to debug.
## Recommended related articles:

ajax video tutorial

The above is the detailed content of 19 classic ajax interview questions. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:cnblogs. If there is any infringement, please contact admin@php.cn delete
JavaScript Applications: From Front-End to Back-EndJavaScript Applications: From Front-End to Back-EndMay 04, 2025 am 12:12 AM

JavaScript can be used for front-end and back-end development. The front-end enhances the user experience through DOM operations, and the back-end handles server tasks through Node.js. 1. Front-end example: Change the content of the web page text. 2. Backend example: Create a Node.js server.

Python vs. JavaScript: Which Language Should You Learn?Python vs. JavaScript: Which Language Should You Learn?May 03, 2025 am 12:10 AM

Choosing Python or JavaScript should be based on career development, learning curve and ecosystem: 1) Career development: Python is suitable for data science and back-end development, while JavaScript is suitable for front-end and full-stack development. 2) Learning curve: Python syntax is concise and suitable for beginners; JavaScript syntax is flexible. 3) Ecosystem: Python has rich scientific computing libraries, and JavaScript has a powerful front-end framework.

JavaScript Frameworks: Powering Modern Web DevelopmentJavaScript Frameworks: Powering Modern Web DevelopmentMay 02, 2025 am 12:04 AM

The power of the JavaScript framework lies in simplifying development, improving user experience and application performance. When choosing a framework, consider: 1. Project size and complexity, 2. Team experience, 3. Ecosystem and community support.

The Relationship Between JavaScript, C  , and BrowsersThe Relationship Between JavaScript, C , and BrowsersMay 01, 2025 am 12:06 AM

Introduction I know you may find it strange, what exactly does JavaScript, C and browser have to do? They seem to be unrelated, but in fact, they play a very important role in modern web development. Today we will discuss the close connection between these three. Through this article, you will learn how JavaScript runs in the browser, the role of C in the browser engine, and how they work together to drive rendering and interaction of web pages. We all know the relationship between JavaScript and browser. JavaScript is the core language of front-end development. It runs directly in the browser, making web pages vivid and interesting. Have you ever wondered why JavaScr

Node.js Streams with TypeScriptNode.js Streams with TypeScriptApr 30, 2025 am 08:22 AM

Node.js excels at efficient I/O, largely thanks to streams. Streams process data incrementally, avoiding memory overload—ideal for large files, network tasks, and real-time applications. Combining streams with TypeScript's type safety creates a powe

Python vs. JavaScript: Performance and Efficiency ConsiderationsPython vs. JavaScript: Performance and Efficiency ConsiderationsApr 30, 2025 am 12:08 AM

The differences in performance and efficiency between Python and JavaScript are mainly reflected in: 1) As an interpreted language, Python runs slowly but has high development efficiency and is suitable for rapid prototype development; 2) JavaScript is limited to single thread in the browser, but multi-threading and asynchronous I/O can be used to improve performance in Node.js, and both have advantages in actual projects.

The Origins of JavaScript: Exploring Its Implementation LanguageThe Origins of JavaScript: Exploring Its Implementation LanguageApr 29, 2025 am 12:51 AM

JavaScript originated in 1995 and was created by Brandon Ike, and realized the language into C. 1.C language provides high performance and system-level programming capabilities for JavaScript. 2. JavaScript's memory management and performance optimization rely on C language. 3. The cross-platform feature of C language helps JavaScript run efficiently on different operating systems.

Behind the Scenes: What Language Powers JavaScript?Behind the Scenes: What Language Powers JavaScript?Apr 28, 2025 am 12:01 AM

JavaScript runs in browsers and Node.js environments and relies on the JavaScript engine to parse and execute code. 1) Generate abstract syntax tree (AST) in the parsing stage; 2) convert AST into bytecode or machine code in the compilation stage; 3) execute the compiled code in the execution stage.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools