下面的代码对我来说似乎有效;我真的有语法错误吗?在控制台中运行此代码:
$("body").append($("<script />", {
html: " window.fbAsyncInit = function() { "+
" FB.init({"+
" appId : '[valid_id]', // App ID"+
" status : true, // check login status"+
" cookie : true, // enable cookies to allow the server to access the session"+
" xfbml : true // parse XFBML"+
" });"+
" };"+
" (function(d){"+
" var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];"+
" if (d.getElementById(id)) {return;}"+
" js = d.createElement('script'); js.id = id; js.async = true;"+
" js.src = 'https://connect.facebook.net/en_US/all.js';"+
" ref.parentNode.insertBefore(js, ref);"+
" }(document));"
}));
回报:
SyntaxError:输入意外结束