$(document).ready(function() {
$.ajax({
type: "POST",
url: "Default2.aspx/sayHello",
cache:false,
contentType: "application/json; charset=utf-8",
data:"{}",
dataType: "json",
success: AjaxSucceeded,
error: AjaxFailed
});
});
function AjaxSucceeded(result) {
alert(result.d);
}
function AjaxFailed(result) {
alert(result.status + ' ' + result.statusText);
}
后台方法
[WebMethod()]
public static string sayHello()
{
return "hello ";
}
提示错误是 200 OK ---- 额郁闷了一天 不懂 为什么 啊 求解 。。。。。。