我正在使用 VS2010 和 jquery-1.4.1.js 版本,我尝试访问 WCF 服务,但出现奇怪的错误“访问被拒绝” in jquery-1.4.1.js在页码处4982
jquery-1.4.1.js:
// Open the socket
// Passing null username, generates a login popup on Opera (#2865)
if ( s.username ) {
xhr.open(type, s.url, s.async, s.username, s.password);
} else {
xhr.open(type, s.url, s.async);
}
这就是我的通话方式
function PostData() {
var webMethod = 'http://myservices/SomeService.svc/GetCount'
var parameters = "{'Id': '" + "1" + "'}"
$.ajax({
type: "POST",
url: webMethod,
data: parameters,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
//$(divToBeWorkedOn).html(msg.d);
debugger
},
error: function (e) {
//$(divToBeWorkedOn).html("Unavailable");
}
});
}
可能是什么问题?我测试了我的 WCF 服务,它工作正常,我尝试通过 ASP.NET 连接并添加 Web 引用,看看是否有任何问题。