Interview questions about AJAX (with answers)
The following are the AJAX interview questions I have compiled for you. Interested students can take a look.
[Related topic recommendations: ajax interview questions (2020)]
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 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.
Why use ajax:
The advantages of Ajax applications are:
1. Improved 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 undertaken by the server, thereby reducing Reduce the server load under large user volume.
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.
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
##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. end. 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.
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
#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 an Ajax application
Through XML data or string
How to get the server-side response on the browser side XML data.
The responseXMl attribute of the XMLHttpRequest object
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 newXMLHttpRequest() in Firefox.
Let’s introduce the common methods and methods of XMLHttpRequest object. Attributes.
open("method","URL") establishes a call to the server. The first parameter is the HTTP request method. It can be GET, POST or any other method supported by the server you want to call. The way.
The second parameter is the URL of the requested page.
send() method, send a specific request
abort() method, stop the current request
readyState attribute request status has 5 possible values 0=not initialized, 1=loading
2= To load, 3=Interaction, 4=Complete
responseText The response of the attribute server, expressed as a string
reponseXML The response of the attribute server, expressed as XML
status The HTTP status code of the server, 200 corresponds to ok 400 Corresponding to not found
What is XML
XML is an extended markup language that can describe data with a series of simple tags.
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.
If you are familiar with a certain ajax framework, he may ask how to use it in the program This 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 can make the client The client uses JavaScript to directly call the server's Java method and returns the value to JavaScript, just like a direct local client call (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
What is the full name of AJAX? Introduce AJAX?
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 technology that uses existing standards.
Use AJAX to create better, faster, and more user-friendly web applications.
AJAX technology is based on Javascript and HTTP Request.
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.
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.
The above are the interview questions about AJAX that I compiled for you. I hope it will be helpful to you in the future.
Related articles:
Detailed analysis of how to use AJAX (code pasted)
Combined with detailed interpretation of the code, string connection in Javascript
Detailed explanation of the Windows object course in JS
The above is the detailed content of Interview questions about AJAX (with answers). For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Using Ajax to obtain variables from PHP methods is a common scenario in web development. Through Ajax, the page can be dynamically obtained without refreshing the data. In this article, we will introduce how to use Ajax to get variables from PHP methods, and provide specific code examples. First, we need to write a PHP file to handle the Ajax request and return the required variables. Here is sample code for a simple PHP file getData.php:

Build an autocomplete suggestion engine using PHP and Ajax: Server-side script: handles Ajax requests and returns suggestions (autocomplete.php). Client script: Send Ajax request and display suggestions (autocomplete.js). Practical case: Include script in HTML page and specify search-input element identifier.

Ajax (Asynchronous JavaScript and XML) allows adding dynamic content without reloading the page. Using PHP and Ajax, you can dynamically load a product list: HTML creates a page with a container element, and the Ajax request adds the data to that element after loading it. JavaScript uses Ajax to send a request to the server through XMLHttpRequest to obtain product data in JSON format from the server. PHP uses MySQL to query product data from the database and encode it into JSON format. JavaScript parses the JSON data and displays it in the page container. Clicking the button triggers an Ajax request to load the product list.

In the field of folding screens, small folding screens are also loved by many young users due to their lightweight, portable, exquisite and compact fashion attributes. In the previous review of the Samsung Galaxy Z Fold6 large folding screen, I gave it a "more square and more AI" evaluation. The small folding screen released at the same time, Samsung Galaxy Z Flip 6, has also attracted much attention. So what will it be like? Today, let’s unlock this new fashion product together. "Light" design: The fashionable appearance on the fingertips is the same as Galaxy Z Fold 6. The Galaxy Z Flip 6 body adopts a square design. In the unfolded state, the fuselage is slender than the average candy bar machine. The front and rear are connected by a straight-sided middle frame, and the four R corners retain a rounded shape.

In order to improve Ajax security, there are several methods: CSRF protection: generate a token and send it to the client, add it to the server side in the request for verification. XSS protection: Use htmlspecialchars() to filter input to prevent malicious script injection. Content-Security-Policy header: Restrict the loading of malicious resources and specify the sources from which scripts and style sheets are allowed to be loaded. Validate server-side input: Validate input received from Ajax requests to prevent attackers from exploiting input vulnerabilities. Use secure Ajax libraries: Take advantage of automatic CSRF protection modules provided by libraries such as jQuery.

Which of the following occupations is a good helper for scientific baby care? Ant New Village’s today’s question. Ant New Village’s today’s answer is nanny. Nanny is really professional in taking care of babies. Follow the editor to read this Ant New Village’s today’s answer 3.7 for the specific content. The latest 2024, I hope it can help you. Ant New Village Today's Answers Latest Ant New Village Today's Answers 3.7 Question: Which of the following professions is a good helper in scientific child care Answer: Nanny Analysis: A nanny is a good helper in scientific child care, which refers to the use of modern educational concepts and scientific methods Professionals who provide daily care, nursing and education for babies aged 0-3 years old.

What is today’s answer to Ant Manor 3.11? Today's questions are: Who is the protagonist of the idiom "stand out"? Which of the following vegetables has another name "chrysanthemum vegetable"? There are many friends who still don’t know the answer to the question, so the editor below will bring you today’s answers to the latest Ant Manor Chicken 3.11 in 2024. Interested friends, please come and find out together. Summary of today's answers to Ant Manor Today's answers to Ant Manor 3.11 Question 1: Who is the protagonist of the idiom "stand out"? Correct answer: Maosui Ant Manor 3.11 Question 1 answer details Question 2: Which of the following vegetables has another name "chrysanthemum vegetable"? Correct answer: Artemisia Ant Manor 3.11 question 2 answer details Ant Manor daily question How to participate: 1. First open Alipay

What is today’s answer to Ant Manor 1.28? Today’s questions are: Why do the surrounding walls of electric lamps become easily “blackened” after being used for a long time? Why is the southwestern folk dish "Zhe'ergen" also called "Houttuynia cordata"? There are many friends who still don’t know the answer to the question, so the editor below will bring you today’s answers to the latest Ant Manor Chicken 1.28 in 2023. Interested friends, come and find out together. Summary of Ant Manor's Today's Answers Ant Manor's Today's Answers 1.28 Question 1: Why are the surrounding walls easily "blacked out" after the electric lamp has been used for a long time? Correct answer: Particle deposition leads to Ant Manor 1.28 Question 1 answer details Question 2: Why is the southwestern folk dish "Zheergen" also called "Houttuynia cordata"? Correct answer: Fishy-smelling Ant Manor 1.2
