在firefox

时间:2016-07-18 14:27:19

标签: javascript jquery facebook

我试图在加载facebook sdk文件后执行一些页面初始化代码。目前它默默地失败了,我很难调试。

仅在firefox

上发生

$.getScript('//connect.facebook.net/en_US/all.js',    function () {
    debugger;
  // debugger is never hit, or if I add any console.logs
});

1 个答案:

答案 0 :(得分:0)

尝试传递脚本的完整路径。您可以使用.done& .fail可以解决任何错误

$.getScript( "http://somedomain/en_US/all.js" )
  .done(function( script, textStatus ) {
    console.log( textStatus );
  })
  .fail(function( jqxhr, settings, exception ) {
    // Log the error
});