关于向其站点post提交问题

ccssddnnsb ccssddnnsb 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
我现在一个站点A t1.htm ,代码中包含需要向B站select.asp 进行post提交的数据并返回结果。
但我发现http://www.a.com/t1.htm根本就不会有反应,js不能实现这种操作?

站点A t1.htm
	  <script language="JavaScript" type="text/JavaScript">
function testpost() {

var url='http://www.b.com/select.asp';
var pars= 'HomeCity='+encodeURI('北京')';
var myAjax = new Ajax.Request( url, { method:'post',
//requestHeader: ['Content-Type','application/x-www-form-urlencoded'],  //---------------- C
parameters:pars,
onComplete:showResponse
}
);
}

function showResponse(prototype){//回调函数
var txtA = prototype.responseText;
alert(txtA);
}
</script>

...全文
评论 17
收藏 已收藏
分享
返回顶部
ccssddnnsb
Ajax 52,778 成员 25,334 内容