Ajax同步和异步传输
2013年08月04日
⁄ 综合
⁄ 共 1644字 ⁄ 字号
小 中 大
-
-
- function RequestByGet(nProducttemp,nCountrytemp)
- {
- var xmlhttp
-
- if (window.XMLHttpRequest)
- {
-
- xmlhttp = new XMLHttpRequest();
- }
- else if (window.ActiveXObject)
- {
-
- xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
- }
-
-
- var URL="http:
- xmlhttp.open("GET",URL, false);
-
- xmlhttp.send(null);
- var result = xmlhttp.status;
-
-
- if(result==200)
- {
- document.getElementById("div_RightBarBody").innerHTML=xmlhttp.responseText;
- }
- xmlhttp = null;
- }
-
-
-
- var xmlhttp
-
- function RequestByGet(nProducttemp,nCountrytemp)
- {
- if (window.XMLHttpRequest)
- {
-
- xmlhttp = new XMLHttpRequest();
- }
- else if (window.ActiveXObject)
- {
-
- xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
- }
-
-
- var URL="http://www.baidu.com/";
- xmlhttp.open("GET",URL, true);
- xmlhttp.onreadystatechange = handleResponse;
-
- xmlhttp.send(null);
- }
-
- function handleResponse()
- {
- if(xmlhttp.readyState == 4 && xmlhttp.status==200)
- {
- document.getElementById("div_RightBarBody").innerHTML=xmlhttp.responseText;
- xmlhttp = null;
- }
- }