次の C#/jQuery で 500 を取得し続けます。特定の実装は正しくない可能性があり、それは大きな問題ではありません。私はハローワールドを立ち上げようとしています。C#に引数がない場合は機能しますが、データを受信しようとするとすぐに500が返されます.
[WebMethod]
public static string Test(string s)
{
// never gets here
}
$.ajax({
type: "POST",
url: "ajax.aspx/" + method,
/*async: true,*/
data: "{data:'" + data + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
callback(data.d);
}
});
最新の試みはこれであり、まだ機能しません:
[WebMethod()]
public static string Test(string data)
{
// never gets here
return "hello world";
}
$.ajax({
type: "POST",
url: "ajax.aspx/Test",
data: "data: {data:'abc'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
alert("back");
}
});