【发布时间】:2012-08-20 16:34:29
【问题描述】:
我正在使用 jquery ajax 通过 Asp.net 调用 Web 服务。但是我的 WebMethod 没有触发。 为什么?
$(document).ready(function () {
$('#btnAdresBilgisi').click(function () {
$.blockUI();
$.ajax({
type: "GET",
url: "OnKayitWebService.asmx/HelloWorld",
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: OnSuccess,
error: AjaxFailed
});
$.unblockUI();
});
function AjaxFailed(response) {
if (response.d) {
alert("Güncelleme işlemi başarısızdır.", 'Bilgi');
}
}
function OnSuccess(response) {
if (response.d) {
alert("Güncelleme işlemi başarılıdır.", 'Bilgi');
}
}
});
[WebMethod]
public string HelloWorld() {
return "hello";
}
【问题讨论】:
-
你的 js 调试器说什么?
-
我没用过js调试器。我正在使用 Firefox“错误控制台”。但它没有给出错误。
标签: jquery asp.net web-services asmx