search
HomeWeb Front-endJS Tutorial20 classic AJAX interview questions. After reading this, you will no longer be afraid of interviews.

This article mainly talks about 20 interview questions about ajax. If you know these questions, you will no longer be afraid of interviews. According to the answers above, you will definitely find a good job. Let us look at this article now

1. What is AJAX and why should we use Ajax (please talk about your understanding of Ajax)
What is ajax:
AJAX is " Abbreviation for "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 ObjectModel) 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.
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, reducing Unnecessary data round-trips reduce bandwidth usage
3. The Ajax engine runs on the client and takes on part of the work originally undertaken by the server, thus reducing the server load under a large number of users.
2. What is the biggest feature of AJAX.
Ajax can achieve dynamic non-refresh (partial refresh)
It means that data can be maintained 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
onFailure
onUninitialized
onLoading
onLoaded
onInteractive
onComplete
onException
7.Ajax and JavaScript difference.

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 an Ajax application
Through XML data or string
8. How to get the XML data responded by the server on the browser side.
The responseXMl attribute of the XMLHttpRequest object

9. Is there any difference in how the XMLHttpRequest object is created in IE and Firefox.

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

10. Introduce the common methods and properties of the 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 specific request
abort() method, stop the current request
The readyState attribute has 5 available values: 0=not initialized, 1=loading
2=Loading, 3=Interacting, 4=Completed
responseText attribute The server's response, expressed as a string
responseXML attribute The server's response, expressed as XML
status HTTP status code of the server, 200 corresponds to ok and 400 corresponds to not found
12. What is XML

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

13 , XML parsing method
Commonly used are 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 complex to program.
14. What framework (package) are you using?

This question is a must, and is usually asked at the very beginning. will ask.
The more popular ones in java are dojo, Prototype, JQuery, Dwr, extjs, etc.
15. If you are familiar with a certain ajax framework, he may ask how to use this framework in the program

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's Java method and return the value to JavaScript, just like calling it directly on the local client. The same (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 to realize javascript calling Java code
16. Introduce the Prototype

F() function, what are the functions of $A() function

F() Functions are 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.

17. Introduce the XMLHttpRequest object

Through the XMLHttpRequest object, Web developers can perform partial updates to the page after the page is loaded.
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.
XMLHttpRequest object is supported in IE5.0, Safari 1.2, Mozilla1.0/Firefox, Opera 8 and NetScapt7.

18. 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. (If you want to see more, go to the PHP Chinese website AJAX Development Manual column to learn)

AJAX technology is based on Javascript and HTTP Request.

19. Ajax is mainly What technologies are included?
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 performs 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.

20. 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.

This article ends here (if you want to see more, go to the PHP Chinese website AJAX User Manual column to learn). If you have any questions, you can leave a message below.

The above is the detailed content of 20 classic AJAX interview questions. After reading this, you will no longer be afraid of interviews.. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
JavaScript and the Web: Core Functionality and Use CasesJavaScript and the Web: Core Functionality and Use CasesApr 18, 2025 am 12:19 AM

The main uses of JavaScript in web development include client interaction, form verification and asynchronous communication. 1) Dynamic content update and user interaction through DOM operations; 2) Client verification is carried out before the user submits data to improve the user experience; 3) Refreshless communication with the server is achieved through AJAX technology.

Understanding the JavaScript Engine: Implementation DetailsUnderstanding the JavaScript Engine: Implementation DetailsApr 17, 2025 am 12:05 AM

Understanding how JavaScript engine works internally is important to developers because it helps write more efficient code and understand performance bottlenecks and optimization strategies. 1) The engine's workflow includes three stages: parsing, compiling and execution; 2) During the execution process, the engine will perform dynamic optimization, such as inline cache and hidden classes; 3) Best practices include avoiding global variables, optimizing loops, using const and lets, and avoiding excessive use of closures.

Python vs. JavaScript: The Learning Curve and Ease of UsePython vs. JavaScript: The Learning Curve and Ease of UseApr 16, 2025 am 12:12 AM

Python is more suitable for beginners, with a smooth learning curve and concise syntax; JavaScript is suitable for front-end development, with a steep learning curve and flexible syntax. 1. Python syntax is intuitive and suitable for data science and back-end development. 2. JavaScript is flexible and widely used in front-end and server-side programming.

Python vs. JavaScript: Community, Libraries, and ResourcesPython vs. JavaScript: Community, Libraries, and ResourcesApr 15, 2025 am 12:16 AM

Python and JavaScript have their own advantages and disadvantages in terms of community, libraries and resources. 1) The Python community is friendly and suitable for beginners, but the front-end development resources are not as rich as JavaScript. 2) Python is powerful in data science and machine learning libraries, while JavaScript is better in front-end development libraries and frameworks. 3) Both have rich learning resources, but Python is suitable for starting with official documents, while JavaScript is better with MDNWebDocs. The choice should be based on project needs and personal interests.

From C/C   to JavaScript: How It All WorksFrom C/C to JavaScript: How It All WorksApr 14, 2025 am 12:05 AM

The shift from C/C to JavaScript requires adapting to dynamic typing, garbage collection and asynchronous programming. 1) C/C is a statically typed language that requires manual memory management, while JavaScript is dynamically typed and garbage collection is automatically processed. 2) C/C needs to be compiled into machine code, while JavaScript is an interpreted language. 3) JavaScript introduces concepts such as closures, prototype chains and Promise, which enhances flexibility and asynchronous programming capabilities.

JavaScript Engines: Comparing ImplementationsJavaScript Engines: Comparing ImplementationsApr 13, 2025 am 12:05 AM

Different JavaScript engines have different effects when parsing and executing JavaScript code, because the implementation principles and optimization strategies of each engine differ. 1. Lexical analysis: convert source code into lexical unit. 2. Grammar analysis: Generate an abstract syntax tree. 3. Optimization and compilation: Generate machine code through the JIT compiler. 4. Execute: Run the machine code. V8 engine optimizes through instant compilation and hidden class, SpiderMonkey uses a type inference system, resulting in different performance performance on the same code.

Beyond the Browser: JavaScript in the Real WorldBeyond the Browser: JavaScript in the Real WorldApr 12, 2025 am 12:06 AM

JavaScript's applications in the real world include server-side programming, mobile application development and Internet of Things control: 1. Server-side programming is realized through Node.js, suitable for high concurrent request processing. 2. Mobile application development is carried out through ReactNative and supports cross-platform deployment. 3. Used for IoT device control through Johnny-Five library, suitable for hardware interaction.

Building a Multi-Tenant SaaS Application with Next.js (Backend Integration)Building a Multi-Tenant SaaS Application with Next.js (Backend Integration)Apr 11, 2025 am 08:23 AM

I built a functional multi-tenant SaaS application (an EdTech app) with your everyday tech tool and you can do the same. First, what’s a multi-tenant SaaS application? Multi-tenant SaaS applications let you serve multiple customers from a sing

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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
Will R.E.P.O. Have Crossplay?
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools