我看不出这个简单代码的工作问题
setdata.asmx
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
[System.Web.Script.Services.ScriptService]
public class setdata : System.Web.Services.WebService {
public setdata () {
//Uncomment the following line if using designed components
//InitializeComponent();
}
[WebMethod]
public string HelloWorld() {
return "Hello World";
}
}
my jquery
$.ajax({
method: "POST",
url: "setdata.asmx/HelloWorld",
contentType: "text/plain; charset=utf-8",
//data: { category: category },
success: function (txt) {
alert(txt);
},
error: function(jqXHR, textStatus, errorThrown ){
alert("Error:"+jqXHR + textStatus + errorThrown);
}
});
错误是:
[object Object]errorInternal Server Error
我该如何解决
我对问题进行了猜测:-
jquery 在我的网站名为 web1 的 admin 文件夹中的 default.aspx 页面内,我发布的 url 只是 setdata.asmx ,服务器是否在 root 的当前目录中查找 setdata.asmx目录