jQuery Ajax响应:成功时将响应设置为null
我想从jQuery.ajax()调用本地托管在我机器上的.net webservice。 脚本包含在static.html文件中。 已触发成功函数,但响应数据为空jQuery Ajax响应:成功时将响应设置为null,ajax,jquery,Ajax,Jquery,我想从jQuery.ajax()调用本地托管在我机器上的.net webservice。 脚本包含在static.html文件中。 已触发成功函数,但响应数据为空 $.ajax({ type: "GET", data: '{continent: "' + $('#txtContinent').val() + '"}', url: "http://localhost:60931/Service1.asmx/Ge
$.ajax({
type: "GET",
data: '{continent: "' + $('#txtContinent').val() + '"}',
url: "http://localhost:60931/Service1.asmx/GetCountries",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(response) {
alert(response);
},
failure: function(msg) {
$('#result').empty().append(msg);
}
});
当我提醒响应时,它给我空值,
有人能告诉我我哪里出错了吗,提前谢谢。这是因为您可能是从一个不在
中的静态页面调用ajax的http://localhost:60931/
。您可以将静态html放在本地主机中,并尝试通过相同的url运行它。或者,您可以通过添加
error : function(xhr,status,error){
alert(status);
},
您是否安装了Firebug,或者(如果您使用的是Chrome),是否查看了开发人员工具中的控制台?