In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly shows you the "sample analysis of Ajax communication principles XMLHttpRequest", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn the "Ajax communication principles XMLHttpRequest example analysis" this article.
Obviously, AJax is a technology that uses JavaScript scripts to access data.
AJAX enables web pages to be updated asynchronously. This is to make a partial update to the page without reloading the entire page.
XMLHttpRequest is the key to AJAX
Browsers now support XMLHttpRequest objects (IE5 and IE6 use ActiveXObject).
There are five states of readyState for requesting data from the background: server is not initialized, 1: server connection has been established, 2 requests have been accepted, 3 requests are being processed, 4 requests are completed.
Every time you change the state, you can trigger an onreadystatechange event. Status has two states: 200,404: page not found.
Let's take a look at an Ajax foreground implementation code:
The copy code is as follows:
Untitled page
Function getName () {
Var xmlhttp
If (window.XMLHttpRequest) {
Xmlhttp=new XMLHttpRequest ()
} else {
Xmlhttp=new ActiveXObject ("Microsoft.XMLHTTP")
}
Xmlhttp.onreadystatechange=function () {
If (xmlhttp.readyState==4 & & xmlhttp.status==200) {
Alert ("Hello:" + xmlhttp.responseText)
}
}
Xmlhttp.open ("post", "Default.aspx?id=gname", true)
Xmlhttp.send ()
}
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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.