CNET中国旗舰网站

ZDNet China | CNET科技资讯网 | 政府采购 | 行业网站联盟





 
标题: [转贴] ajax 是否不能传值到别的domain来取回传?
mz89757053
版主
Rank: 7Rank: 7Rank: 7


UID 304999
精华 0
积分 6933
帖子 8295
威望 116
ZD币 1002 元
阅读权限 250
注册 2008-3-10
状态 离线
  楼主
发表于 2008-3-18 14:14  资料  个人空间  短消息  加为好友 
开发者在线

ajax 是否不能传值到别的domain来取回传?

是否不能传值到非本机的伺服器?谢谢   
   
  本机的ajax:   
  function   checkLogin()   {   
                  http_request   =   false;   
   
  url="http://www.sing.com/check.php?action=login";   
  alert(url);   
                  if   (window.XMLHttpRequest)   {   //   Mozilla,   Safari,...   
                          http_request   =   new   XMLHttpRequest();   
                          if   (http_request.overrideMimeType)   {   
                                  http_request.overrideMimeType('text/xml');   
                          }   
                  }   else   if   (window.ActiveXObject)   {   //   IE   
                          try   {   
                                  http_request   =   new   ActiveXObject("Msxml2.XMLHTTP");   
                          }   catch   (e)   {   
                                  try   {   
                                          http_request   =   new   ActiveXObject("Microsoft.XMLHTTP");   
                                  }   catch   (e)   {}   
                          }   
                  }   
   
                  if   (!http_request)   {   
                          alert('Giving   up      Cannot   create   an   XMLHTTP   instance');   
                          return   false;   
                  }   
                  http_request.onreadystatechange   =   chk;   
                  http_request.open('GET',   url,   true);   
                  http_request.send(null);   
   
          }   
   
  非本机的   
  http://www.sing.com/check.php   
  <?php   
  if($_GET['action']=="login"){   
  echo   "1";   
  }   
  ?>




顶部
 



当前时区 GMT+8, 现在时间是 2009-7-4 16:33

  Powered by Discuz! 5.5.0 © 2001-2007 Comsenz Inc.
Processed in 0.063180 second(s), 3/3 queries

清除 Cookies - 联系我们 - ZDNetChina中文社区 - 无图版