【发布时间】:2014-04-30 21:13:26
【问题描述】:
我使用 Ajax 从另一个页面中获取信息,但不显示此页面。这是代码
$.ajax({
url: 'another-page.html',
dataType: 'html',
success: function (data) {
//how to get the html title contained in data?
//how to get an element with ID contained in data?
}
});
我觉得这应该在某个地方得到回答,但我找不到它。抱歉,如果这是重复的。如果SO已经有答案,我会删除它。
非常感谢。
【问题讨论】:
-
执行
console.log(data)并检查返回值,然后找到获取标题的方法.. html 内容可能在属性内.. 所以你会做类似$(data.propName).find("title")的事情跨度> -
看看here