Home > Web Front-end > HTML Tutorial > xml=new ActiveXObject('Microsoft.XMLHTTP')出错_html/css_WEB-ITnose

xml=new ActiveXObject('Microsoft.XMLHTTP')出错_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 12:24:02
Original
2198 people have browsed it

I am writing a js script, I write like this
xml=new ActiveXObject("Microsoft.XMLHTTP");
xml.open("GET","http://xxx/test.asp ",false);
xml.send();
Why is this sentence skipped directly when debugging with firbug?


Reply to discussion (solution)

firbug? Use xml=new XMLHttpRequest(); under firefox;

if(window.XMLHttpRequest){ xml=new ActiveXObject("Microsoft.XMLHTTP");}else{   xml=new XMLHttpRequest();}xml.open("GET","http://xxx/test.asp",false);xml.send(); 
Copy after login
Copy after login

firbug ?In firefox, use xml=new XMLHttpRequest();

if(window.XMLHttpRequest){ xml=new ActiveXObject("Microsoft.XMLHTTP");}else{   xml=new XMLHttpRequest();}xml.open("GET","http://xxx/test.asp",false);xml.send(); 
Copy after login
Copy after login

This is correct, why did send go wrong again?
function GetLocalIPAdress(){	if(window.ActiveXObject)	{		xml=new ActiveXObject("Microsoft.XMLHTTP");	}else	{		xml=new XMLHttpRequest();	}	xml.open("GET","http://iframe.ip138.com/ic.asp",false);	xml.send(null);	kk=xml.ResponseText;	alert(kk);	i=kk.indexOf("[");	ie=kk.indexOf("]");	ip=kk.substring(i+1,ie);	alert(ip);	return ip;}
Copy after login

iframe.ip138.com is not your domain and cannot be cross-domain

iframe.ip138.com is not your domain and cannot be cross-domain
Then How can I request this ip address?


iframe.ip138.com is not your domain and cannot be cross-domain
Then how can I request this IP address?

<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js'></script> <script>    function getIp(){        $.getScript(          'http://pv.sohu.com/cityjson' ,function(){           alert( 	 returnCitySN.cip +':' + returnCitySN.cname )          } )    }   getIp();</script>
Copy after login

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template