Ajax starts preparing for the primer


I will launch a series of original Ajax tutorials in the web circle. If you don’t know what AJAX is, please read: what is Ajax?
Before that, we need to do some simple ajax preparation, but you must have the basic ability to write HTML, JavaScript and DOM. Otherwise, you will have a hard time reading this Ajax tutorial. My purpose is to pass this tutorial. You can use ajax technology to realize, read, add and modify your web pages, Delete data operation. Maybe you are an old bird and despise what I wrote, but I still hope you can see some examples demonstrated in this tutorial. Maybe there will be a place to attract you!
There are two things we need to do below. First, we must create an available XMLHttpRequest object. If you don’t know what XMLHttpRequest is, please read: what is XMLHttpRequest?
Because different browsers have different support standards for XMLHttpRequest objects, the so-called available XMLHttpRequest object means to run the object without errors in ie, FF, chrome and other browsers. We use JavaScript to create the object, And write a function. In future Ajax tutorial examples, we will use this function to call XMLHttpRequest. Look at the following code:

[Ctrl + a] select all notes:To import an external JS, you need to refresh the page again]

After running the above code, “object” will pop up in IE browser and “object XMLHttpRequest” will pop up in FF and chrome browsers. If it pops up correctly, it means that the XMLHttpRequest object is created successfully!
Step 2: we use ASP technology to output an XML file. In future Ajax tutorial examples, we will request the file to read, add, delete and modify data. Maybe you don’t know. We can use any language on the server to output the data in XML format. For example, we use ASP to read the data in a table in the database, Then output the data of the table as XML file format to the client. This is also the most standard use method of Ajax! Click View: ASP outputs data in XML format
The following is the source code of the ASP file. You can copy it to your computer for testing  

Copy codeThe code is as follows:
‘from: http://Www.Web666.Net
Author: Kang Dong
‘if you need to reprint, please keep the above information
‘define a variable to hold XML data
dim xml
xml = “<?xml version=’1.0′ encoding=’gb2312′?><body>”
XML = XML & “< MSG > a simple example of ASP outputting XML. Later, in our Ajax tutorial example, we will use this file to read data < / MSG >”
Response.Write xml

Well, the preparation for today’s Ajax system tutorial has been completed. In the next article, we will try the ox knife — reading data in the first Ajax trial

Recommended Today

Vue、Three. JS implementation panorama

1、 First, we need to create a Vue project This paper mainly records the process of building panorama in detail, so building Vue project is not described too much. 2、 Install three js npm install three –save npm install three-trackballcontrols –save npm install three-orbit-controls –save npm i three-obj-mtl-loader –save npm i three-fbx-loader –save npm i […]