我很难通过ajax使用web方法从aspx页面获得响应,但是来自web方法的响应直接转到错误函数并引发内部服务器错误(500)。
$.ajax({
type: "POST",
url: "Home.aspx/getAnalyticsData",
data: data,
contentType: "application/json; charset=utf-8",
dataType: "json",
async: true,
success: function (result) {
var data = result.hasOwnProperty('d') ? result.d : result;
alert(data);
},
error:function(xhr){
alert(data);
}
});
它会抛出错误,
Failed to load resource: the server responded with a status of 500 (Internal Server Error)