返回信息流代码如下,功能就是传一个IP 给一个第三方的服务器,然后服务器反GPS回来
用搜狗没问题, 用editplus调试也没问题 放在chrome下有问题,求达人解决在chrome下整么修改
问题是在xmlhttp.send(data) 这句
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=gb2312" http-equiv=Content-Type>
<SCRIPT language=javascript>
var xmlhttp = new XMLHttpRequest();
function post()
{
var data = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:WBMTWSDL">'
+ '<soapenv:Header/>'
+ '<soapenv:Body>'
+ '<urn:GetAddressByIP>'
+ '<ip>118.229.130.180</ip>'
+ '<key>8003607b9d087e30b4c44458141081bc3c0253b8</key>'
+ '<language>en_US</language>'
+ '</urn:GetAddressByIP>'
+ '</soapenv:Body>'
+ '</soapenv:Envelope>';
var url="http://www.cobub.com/lbs/index.php?lbservice/GetAddressByIP";
alert('open before');
xmlhttp.open("post", url, false);
alert('open after');
xmlhttp.setRequestHeader("Content-Type","text/xml; charset=utf-8");
xmlhttp.setRequestHeader("Content-Length",data.length);
xmlhttp.setRequestHeader("host","http://www.cobub.com/lbs/index.php?lbservice/GetAddressByIP");
xmlhttp.setRequestHeader("SOAPAction","GetAddressByIPWSDL#GetAddressByIP");
alert(data + '!!!');
alert('send before');
xmlhttp.send(data);
alert('send after');
alert(xmlhttp.responseText);
}
function getReady()
{
if(xmlhttp.readyState == 4)
{
alert('ok:\n' + xmlhttp.responseText);
// mapMainWindow.parse(xml);
}
else
{
alert(xmlhttp.readyState);
}
}
</SCRIPT>
<META name=GENERATOR content="MSHTML 8.00.7600.16385"></HEAD>
<BODY><INPUT onclick=post() value=post type=button></INPUT> <INPUT onclick=get() value=get type=button></INPUT> </BODY></HTML>
这是一条镜像帖。来源:北邮人论坛 / www-technology / #14173同步于 2011/7/22
该镜像源已超过 30 天没有更新,可能在源站已被删除。
WWWTechnology机器人发帖
在搜狗下正常,但是在chrome下不正常,求大牛帮忙
RaulSpain007
2011/7/22镜像同步13 回复
订阅后,新回复会通过你的通知中心匿名送达。
9 条回复
这是一个ajax请求,IE和其他浏览器要用不同方法处理。LZ直接用封装好的类库吧,自己写ajax费劲。
我们公司开源的:
http://tangram.baidu.com/codesearch/codesearch.html#tangram-component_stable|modules;baidu.ajax.form;baidu.ajax.get;baidu.ajax.post;baidu.ajax.request
已经给你吧ajax选好了,下下来看看文档baidu.ajax.post();就能用了
IE确实不同,但是这个是在chrome下不可用
【 在 youyo 的大作中提到: 】
: 这是一个ajax请求,IE和其他浏览器要用不同方法处理。LZ直接用封装好的类库吧,自己写ajax费劲。
: 我们公司开源的:
: http://tangram.baidu.com/codesearch/codesearch.html#tangram-component_stable|modules;baidu.ajax.form;baidu.ajax.get;baidu.ajax.post;baidu.ajax.request
: ...................
【 在 youyo 的大作中提到: 】
: 这是一个ajax请求,IE和其他浏览器要用不同方法处理。LZ直接用封装好的类库吧,自己写ajax费劲。
: 我们公司开源的:
: http://tangram.baidu.com/codesearch/codesearch.html#tangram-component_stable|modules;baidu.ajax.form;baidu.ajax.get;baidu.ajax.post;baidu.ajax.request
: ...................
我在网上查了,说是 xmlhttp不能跨域访问的问题...但是为什么IE下却没有问题呢
【 在 zzcc 的大作中提到: 】
: IE确实不同,但是这个是在chrome下不可用
: 【 在 youyo 的大作中提到: 】
: : 这是一个ajax请求,IE和其他浏览器要用不同方法处理。LZ直接用封装好的类库吧,自己写ajax费劲。
: ...................
你懂不懂怎么解决呀...求教呀
ajax确实不能跨域,你试试chrome中右键审查元素> console,看请求时报什么错就好了
【 在 RaulSpain007 的大作中提到: 】
: : 这是一个ajax请求,IE和其他浏览器要用不同方法处理。LZ直接用封装好的类库吧,自己写ajax费劲。
: : 我们公司开源的:
: : http://tangram.baidu.com/codesearch/codesearch.html#tangram-component_stable|modules;baidu.ajax.form;baidu.ajax.get;baidu.ajax.post;baidu.ajax.request
: ...................
【 在 zzcc 的大作中提到: 】 : ajax确实不能跨域,你试试chrome中右键审查元素> console,看请求时报什么错就好了 : 【 在 RaulSpain007 的大作中提到: 】 : : : 这是一个ajax请求,IE和其他浏览器要用不同方法处理。LZ直接用封装好的类库吧,自己写ajax费劲。 : ...................
找了呀,就是不能跨域,查了一天说FF和Chrome安全性好,跨不了,IE6可以跨,不懂怎么搞了
本来就是不能跨域啊,设计的时候没考虑到吗?
【 在 RaulSpain007 的大作中提到: 】
: 找了呀,就是不能跨域,查了一天说FF和Chrome安全性好,跨不了,IE6可以跨,不懂怎么搞了
: --
【 在 zzcc 的大作中提到: 】
: 本来就是不能跨域啊,设计的时候没考虑到吗?
: 【 在 RaulSpain007 的大作中提到: 】
: : 找了呀,就是不能跨域,查了一天说FF和Chrome安全性好,跨不了,IE6可以跨,不懂怎么搞了
: ...................
我对WEB纯是小白哎....网上搜代码,就xmlhttp能看得懂,就用了,在IE上可以,一方chrome上就sb了,只能找找办法了