XMLHTTP提交问题,请高手解答.
为何 我提交时不带参数,就没有错误,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;