How to write responseXML for ajax to return to accept asp
This article mainly introduces "how to write ajax responseXML return to accept asp". In daily operation, I believe many people have doubts about how to write ajax responseXML return to accept asp. Xiaobian consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "how to write ajax responseXML return to accept asp". Next, please follow the editor to study!
The first file, index.asp
Var xmlHttp = false; / / ajax use
Try {
XmlHttp = new ActiveXObject ("Msxml2.XMLHTTP")
} catch (e) {
Try {
XmlHttp = new ActiveXObject ("Microsoft.XMLHTTP")
} catch (e2) {
XmlHttp = false
}
}
If (! xmlHttp & & typeof XMLHttpRequest! = 'undefined') {
XmlHttp = new XMLHttpRequest ()
}
Function callserver ()
{
Var url = "index.asp"
XmlHttp.open ("POST", url,true)
XmlHttp.onreadystatechange = update
XmlHttp.setrequestheader ("content-type", "application/x-www-form-urlencoded")
XmlHttp.send (null)
}
Function update ()
{
If (xmlHttp.readystate==4)
{
Var xmldoc=xmlHttp.responseXML
Var info = xmldoc.getElementsByTagName ("info") [0] .text
Alert (info)
}
}
Callserver ()
Second login.asp
At this point, the study on "how to write the responseXML of ajax to return to accept asp" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!