In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly explains the "introduction of examples of common functions in AJAX". The content of the explanation in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "the introduction of examples of common functions in AJAX".
Create XMLHTTP objects to distinguish IE,Mozilla browsers
The code is as follows:
Function getRequest () {
Http_request = false
If (window.XMLHttpRequest) {
/ / for browsers such as Mozilla, Netscape, Safari, create a XMLHttpRequest
Http_request = new XMLHttpRequest ()
If (http_request.overrideMimeType) {
/ / if the header of the server response is not text/xml, you can call other methods to modify the header
Http_request.overrideMimeType ('text/xml')
}
} else if (window.ActiveXObject) {
/ / for Internet Explorer browsers, create a XMLHttpRequest
Try {
Http_request = new ActiveXObject ("Msxml2.XMLHTTP")
} catch (e) {
Try {
Http_request = new ActiveXObject ("Microsoft.XMLHTTP")
} catch (e) {}
}
}
Return http_request
}
/ / obtain the responseText of Url
The code is as follows:
Function getResponseText (url)
{
Http_request=getRequest ()
Http_request.open ('GET', url, false)
Http_request.send (null)
If (http_request.readyState = = 4)
{
/ / receive a complete server response
If (http_request.status = = 200) {
/ / the value OK of the HTTP server response
Requestdoc = http_request.responseText
/ / write the string returned by the server to the area of the page where ID is message
}
Else {
Requestdoc = http_request.status
}
}
Return requestdoc
}
/ / obtain the responseXML of Url
The code is as follows:
Function getResponseText (url)
{
Http_request=getRequest ()
Http_request.open ('GET', url, false)
Http_request.send (null)
If (http_request.readyState = = 4)
{
/ / receive a complete server response
If (http_request.status = = 200) {
/ / the value OK of the HTTP server response
Requestdoc = http_request.responseXML
/ / write the string returned by the server to the area of the page where ID is message
}
Else {
Requestdoc = http_request.status
}
}
Return requestdoc
}
Thank you for your reading, the above is the content of "introduction of examples of common functions of AJAX". After the study of this article, I believe you have a deeper understanding of the introduction of examples of common functions of AJAX, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.