次のようなjQuery関数からサーバー上でasmxサービスを呼び出そうとしています。
$('.myButton').click(function() {
$.ajax({
type: "POST",
url: "/http://myserver/service.asmx/GetProgramCategories",
cache: false,
contentType: "application/x-www-form-urlencoded",
data: "{}",
dataType: "json",
success: handleHtml,
error: ajaxFailed
});
});
function handleHtml(data, status)
{
for (var count in data.d)
{
alert(data.d[count].Author);
alert(data.d[count].BookName);
}
}
function ajaxFailed(xmlRequest)
{
alert(xmlRequest.status + ' \n\r ' +
xmlRequest.statusText + '\n\r' +
xmlRequest.responseText);
}
デバッグしましたが、エラー500内部サーバーエラーが発生します
次のようなサーバー記述子:
HTTPPOST
以下は、HTTPPOSTリクエストとレスポンスのサンプルです。表示されているプレースホルダーは、実際の値に置き換える必要があります。
POST /service.asmx/GetProgramCategories HTTP/1.1
Host: myhost
Content-Type: application/x-www-form-urlencoded
Content-Length: length
username=string&password=string
HTTP/1.1 200 OK
誰か助けてくれませんか?