Ajax is all called "Asynchronous JavaScript and XML" (Asynchronous JavaScript and XML), a Web development technology that creates interactive Web applications.
Where asynchronous represents Asynchrony,
In addition, JavaScript and XML are nouns.
Where JavaScript is used as a client script
Ajax's main idea is to request server scripts asynchronously (synchronously) through XMLHttpRequest objects. The server returns to the client via Response.Write () after receiving the request.
var xmlHttp; To be defined as global
Create an XML request
function Createxmlhttprequest () {
try {xmlHttp = new ActiveXObject ("Msxml2.xmlhttp"); The catch (_e) {try {xmlHttp = new ActiveXObject ("Microsoft.XMLHTTP"); catch (_e) {}} if (!xmlhttp && typeof xmlhttprequest!= ' undefined ') {try {xmlHttp = new XMLHttpRequest (); catch (e) {xmlHttp = false; } }}
Client through Xmlhttp.responsetext
or Xmlhttp.respnsexml
To get the value returned by the server side. So the result of the server-side return is a normal string. Another is the format of the XML text string in this way not to speak (online search a large)
This main introduction returns XML:
one point to declare: whether XML or plain text is routed as a string!!!!!! but it is necessary to deserialize these formatted XML characters when receiving at both ends (converting strings to XML objects)
A concrete example is given below: The XMLHttpRequest object has been declared
var obj = null; function Initxdom (xmlText) {if (typeof (Domparser)!= "undefined") {//Gecko, Mozil LA, Firefox var parser = new Domparser (); obj = parser.parsefromstring (XmlText, "text/xml"); }</