【发布时间】:2013-02-07 11:04:03
【问题描述】:
我正在尝试从 jQuery 函数调用 asmx 服务 On server,如下所示:
$('.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);
}
我已经调试过了,但它给了我error 500 Internal Server Error
和服务器描述符如下:
HTTP POST
以下是一个示例 HTTP POST 请求和响应。显示的占位符需要替换为实际值。
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
有人可以帮忙吗?
【问题讨论】:
标签: jquery ajax webservice-client