我使用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";
}
答案 0 :(得分:0)
你可以试试这个..
AjaxFailed = function(response) {
if (response.d) {
alert("Güncelleme işlemi başarısızdır.", 'Bilgi');
}
}
OnSuccess = function(response) {
if (response.d) {
alert("Güncelleme işlemi başarılıdır.", 'Bilgi');
}
}