In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces what the ajax asynchronous request server is like, the content is very detailed, interested friends can refer to, hope to be helpful to you.
I used to use jquery's integrated ajax, but now let's learn JavaScript's native ajax.
The following is a simple experiment in which ajax requests a xml content on the server.
Step 1: on the server, create a new xml and name it simpleAjax.xml. Enter the contents of the file as follows: This is the content of the simpleAjax.xml from server!
Step 2: on the server, create a new html, name it simpleAjax.html, and put it in the same directory as the simpleAjax.xml you just created.
SimpleAjax var xmlHttpRequest; / / XMLHttpRequest object name function sendRequest () {/ / send http request getXMLHttpRequest () / / get an operation xmlHttpRequest.open ("GET", "simpleAjax.xml") to be performed when the state changes from a XMLHttpRequest object to xmlHttpRequest xmlHttpRequest.onreadystatechange = stateChange; / / http; / / Connect xmlHttpRequest.send (null) / / send a request to the server (empty here)} function getXMLHttpRequest () {if (window.ActiveXObject) {/ / IE class xmlHttpRequest = new ActiveXObject ("Microsoft.XMLHTTP") } else if (window.XMLHttpRequest) {/ / Chrome class xmlHttpRequest = new XMLHttpRequest () }} function stateChange () {if (xmlHttpRequest.readyState = = 4 & & xmlHttpRequest.status = = 200) {/ / request completed and status OK alert (xmlHttpRequest.responseText) / / reaction}}
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.