この単純なコードの動作に問題が見られません
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 という名前の私の Web サイトの管理フォルダーの default.aspx ページ内にあり、単に setdata.asmx という URL を投稿しています。サーバーはルートの現在のディレクトリで setdata.asmx を探しますか?ディレクトリ