我想访问使用Javascript在.Net中构建的web服务。在Firefox中使用javascript访问webservices时出现的问题
<html>
<head>
<title>Test Web service</title>
<script type="text/javascript">
function httptest(){
var http = new XMLHttpRequest();
var params = "";
var RetFlag = "Webmail-"+ false;
http.open("Post", "http://localhost:3624/_anet/wsCoverageValidate.asmx/CheckCoverage" , false);
http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http.setRequestHeader("Content-length", params.length);
http.setRequestHeader("Connection", "close");
http.onreadystatechange = function()
{
if(http.readyState == 4 && http.status == 200)
{
var resp=http.responseText;
alert(resp);
}
}
http.send(params);
}
</script>
</head>
<body>
<div style="float: left; width: 100%; background-color: Gray;">
<button id="btngo1" value="Go" type="submit" onclick="httptest()">
Go
</button>
</div>
</body>
</html>
这是我的html页面。现在,它可以在Internet Explorer中正常运行,但是它在从Firefox访问时会产生问题。它给我的javascript错误为
Component returned failure code: 0x80004005 (NS_ERROR_FAILURE)
,在错误控制台。我为此搜寻了很多,但没有成功。
请帮帮我。 谢谢
任何帮助Firebug? – emaillenin 2011-05-26 09:26:01
没有。同时调试JavaScript发送到功能,而Web服务已被访问。 – 2011-05-26 11:03:16
尝试jQuery - 它是跨浏览器兼容 – emaillenin 2011-05-26 11:10:44