Ajax1-php (27), ajax1php2. Ajax1-php (27), ajax1php2 A Brief Introduction to web program working principle diagram: the traditional web program working principle diagram: 2, the core object XMLHttpRequest I, create an object in a different browser ajax1-php (27), ajax1php2
1 Introduction
Working Principle of web programs:
Working Principle of traditional web programs:
II. Core objects
XMLHttpRequest
1. create an object
In different browsers, the method for creating ajax objects is slightly different.
IE:
New ActiveXObject ("Microsoft. XMLHTTP ")
III. Ajax object attributes and methods:
1. related methods:
L open (method, url)
Initialize ajax objects
Method: request method post, get
Url: Request resource address
L setRequestHeader (header, value)
Set request header information
Header: Header information
Value: Value
L send (content)
Send request
Content: The passed parameter must be placed here only when the post request is made.
2. related attributes:
L readyState
The status code of the Ajax object, which changes at any time
0: indicates that the object has been created but not initialized.
1: indicates that the object has been initialized but not sent
2: The send method has been called for the request.
3: receiving data (receiving part)
4: Received
L onreadystatechange
The callback function triggered when the status code of the ajax object changes.
L status
Http response status code
L statusText
Http response text
L responseText
Http response content text
L responseXML
Xml data of http response content
There are three main ways to transmit Ajax object data:
Text: responseText
Xml: reponseXML
Json: responseText
Http://www.bkjia.com/PHPjc/998221.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/998221.htmlTechArticleajax1-php (27), ajax1php2 A Brief Introduction to web program working principle diagram: the traditional web program working principle diagram: 2, the core object XMLHttpRequest I, create objects in different browsers...