jQuery Ajax - 返回 [object 对象]
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1417932/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 11:24:53 来源:igfitidea点击:
jQuery Ajax - Returning [object Object]
提问by Ben Shelock
$.get($(this).attr('id'), function(data){
var qp_post = $(data).filter('title');
alert(qp_post);
});
This fetches the content fine however the alert just says
这可以很好地获取内容,但是警报只是说
[object Object]
When I do alert(data); it shows the HTML of the page perfectly.
当我做 alert(data); 它完美地显示了页面的 HTML。
回答by Jochen Ritzel
Yes, that is how jquery works. Are you looking for alert( qp_post.html() );
?
是的,这就是 jquery 的工作方式。你在找alert( qp_post.html() );
吗?