Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/423.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript FB.XFBML.parse Uncaught[对象]_Javascript_Jquery_Facebook - Fatal编程技术网

Javascript FB.XFBML.parse Uncaught[对象]

Javascript FB.XFBML.parse Uncaught[对象],javascript,jquery,facebook,Javascript,Jquery,Facebook,为什么这不起作用 $('.fb-like-button').each (function(){ if ($(this).html() == "" || !$(this).html() || $(this).html() == "undefined") { $(this).html('<fb:like href="'+$(this).attr("data-url")+'" layout="button_count" send="false" s

为什么这不起作用

$('.fb-like-button').each (function(){
    if ($(this).html() == "" || !$(this).html() || $(this).html() == "undefined")
        {
            $(this).html('<fb:like href="'+$(this).attr("data-url")+'" layout="button_count" send="false" show_faces="false" width="100" action="like" font="verdana" colorscheme="light" />');
            FB.XFBML.parse($(this));
            $(this).attr("class", "done");
        }
});
$('.fb-like按钮')。每个(函数(){
如果($(this.html()==“”| |!$(this.html()| |$(this.html()==“未定义”)
{
$(this.html(“”);
FB.XFBML.parse($(this));
$(this.attr(“class”,“done”);
}
});

错误:取消捕获[object object]

好的,我找到了解决方案。我不知道为什么,但这是有效的:

FB.XFBML.parse($(this).get(0));
$(this.attr(“数据url”)你能提醒这个并检查url吗?是的,我做了:console.log($(this.attr(“数据url”))并且url是正确的。错误在这里:FB.XFBML.parse($(this));原因:parse()正在等待DOM元素对象作为参数,而不是jQuery对象。