CNET中国旗舰网站

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





 
标题: [转贴] ajax 跨域名问题
fdc9643
版主
Rank: 7Rank: 7Rank: 7


UID 319152
精华 8
积分 24172
帖子 1756
威望 10950
ZD币 4004 元
阅读权限 250
注册 2008-4-15
状态 离线
  楼主
发表于 2008-4-17 13:30  资料  个人空间  短消息  加为好友 
开发者在线

ajax 跨域名问题

function   initxmlhttp()   
  {   
      ...省略   
  }   
      var   xmlhttp=initxmlhttp();   
    var   url='http://localhost/hit.php';   
      var   poststr='ads_id='+ads_id;   
        
      xmlhttp.open('POST',url,true);   
      
      xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');   
      
      xmlhttp.send(poststr);   
   
  当url的地址跟本页面(假如本页面:http://www.163.com)不在同个域名时,提示没有权限。有解决的办法吗?




顶部
 



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

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

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