【发布时间】:2011-08-09 19:37:29
【问题描述】:
响应是一个 HTML 文档(来自链接的 href 请求)
var data = $(response).find('body').html();
alert(data);
// I get a alert with nothing...
完整代码:
$.ajax({
url: $(this).attr('href'),
type: 'GET',
success: function(response){
var data = $(response).find('body').html();
alert(data);
}
});
【问题讨论】:
-
响应是否包含
body元素? -
@BiberFiver:
alert(response)有输出吗? -
是的,整个html,是的,里面有body,是普通的html页面
-
您可以尝试提醒数据以查看响应是什么,或者如果您使用的是萤火虫,您可以在响应选项卡中看到它
-
首先尝试 console.log($(response)) 并检查它是否是您所期望的
标签: javascript jquery html ajax