XMLHTTP提交问题,请高手解答.

jaffler jaffler 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
为何 我提交时不带参数,就没有错误,status=200
带参数提交(web services 的insert1方法也相应的带参数),就会出错,status=500呢??
objXmlHttp.send("mystr1=tree");


// Create an XMLHTTP object for document transport.
try
{
var objXmlHttp = new ActiveXObject("MSXML2.XMLHTTP");
}
catch(ex)
{
XDocument.UI.Alert("Could not create MSXML2.XMLHTTP object.\r\n" + ex.number + " - " + ex.description);

// Return with eventObj.ReturnStatus == false,
// because no change was made to this value.
return;
}

// Post the XML document to strUrl.
objXmlHttp.open("POST", "http://localhost/test/services1.asmx/Insert1", false);
try
{
//objXmlHttp.send(XDocument.DOM.xml);
XDocument.UI.Alert(XDocument.DOM.xml);
objXmlHttp.send();
if(objXmlHttp.status != 200)
{
XDocument.UI.Alert("Failed while sending the request.\r\n" + objXmlHttp.status + " - " +
objXmlHttp.statusText);

eventObj.ReturnStatus = false;
return;
}

}
catch(ex)
{
XDocument.UI.Alert("Could not post (ASP) document to " +
strUrl + "\r\n" + ex.number + " - " + ex.description);

// Return with eventObj.ReturnStatus == false.
return;
}
// If here, the submit operation is has been successful.
eventObj.ReturnStatus = true;
...全文
评论
收藏 已收藏
分享
返回顶部
jaffler
.NET社区 62,272 成员 668,968 内容