在线询问--关于ajax跨域访问--十万火急!!
代码如下:在apache 下面的代码
<html>
<head>
<script type="text/javascript">
function creatConnect(urlMsg)
{
var ajax=null;
try{
ajax = new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e1)
{
try
{
ajax = new ActiveXObject("Microsoft.XMLHTTP");
}catch(e2)
{
}
}
if(!ajax && typeof XMLHttpRequest != 'undefined'){
ajax = new XMLHttpRequest();
}
if(urlMsg.indexOf("?")>0){
urlMsg += "&randnum=" + Math.random();
}else{
urlMsg += "?randnum=" + Math.random();
}
ajax.open("GET",urlMsg,true);
ajax.onreadystatechange=function (){
if(ajax.readyState==4)
{
if(ajax.status==200)
{
//alert(ajax.responseText);
//var temp = document.getElementById("show");
//temp.value = ajax.responseText;
//temp=null;
}
}
};
ajax.send(null);
}
function ff()
{
creatConnect("http://192.168.8.6:66/test/test.fcg");//请求另一个服务器下的进程,
}
function test1()
{
setInterval("ff()",1000);
}
</script>
</head>
<body onload=test1()>
<input type=text id=show value="fafa">
</body>
</html>
请高手帮忙看看。。。ORZ~~~~~