var DataToSend = "id=1&word=hello ";
var xmlhttp = new ActiveXObject( "Microsoft.XMLHTTP ");
xmlhttp.Open( "POST ", "Receiver.asp ",false);
//关键在下面这句
xmlhttp.setRequestHeader( "Content-Type ", "application/x-www-form-urlencoded ");
xmlhttp.send(DataToSend);
alert(xmlhttp.responseXML.xml);
var xmlhttp = new ActiveXObject( "Microsoft.XMLHTTP ");
xmlhttp.Open( "POST ", "Receiver.asp ",false);
//关键在下面这句
xmlhttp.setRequestHeader( "Content-Type ", "application/x-www-form-urlencoded ");
xmlhttp.send(DataToSend);
alert(xmlhttp.responseXML.xml);
本文介绍了一段使用ActiveXObject实现POST请求发送数据到特定ASP页面,并接收XML响应的过程。重点在于理解如何构造请求参数字符串,设置Content-Type,以及解析返回的XML数据。
1416

被折叠的 条评论
为什么被折叠?



