我尝试用一个非常简单的ajax调用来调用我的Web服务,但是没有它不起作用 这是我的ajax电话:
$(document).ready(function () {
$("#btn1").click(function () {
var murl = window.location.href;
var url = murl.replace("http://", "").split("/");
var filename = url[url.length - 1].substr(0, url[url.length - 1].lastIndexOf("."));
$.ajax({
type: "POST",
url: "/WebService.asmx?op=ActivateFuncs", //the url is correct, surely
data: { url: murl.replace("/", "\\"), filename: filename },
success: function (data) {
var d = data;
console.log(d);
},
error: function (xhr, ajaxOptions, thrownError) {
alert(xhr.StatusText);
}
});
});
});
还有我的WebService方法:
public WebService()
{
}
[WebMethod]
public string ActivateFuncs()
{
string url = Context.Request["url"], filename = Context.Request["fileame"];
return "url :" + url + ", file name: " + filename;
}
它返回“内部服务器错误”