-1

我收到此错误:

SyntaxError: missing '}' after argument list

使用此代码:

  (function(d, debug){
     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 = "//connect.facebook.net/en_US/all" + 
        (debug ? "/debug" : "") + ".js";
     ref.parentNode.insertBefore(js, ref);
   }(document, false));

var checkboxes = document.querySelectorAll('input[type="checkbox"]'),
  numCheckboxes = checkboxes.length,
  x;

$(function(){
    // Set up so we handle click on the button
    $('#like_all').click(function(){
      for(x=0;x<numCheckboxes;x++) {   //the error is indicated here
        if (checkboxes[x].checked === true) {
      FB.api(
        'me/og.likes'
        'post',
        {
          object: checkboxes[x].value;
        },
        function(response) {
          if(response===null)
          {
            alert("Could not like page "+checkboxes[x].name);
          }
        }
        )

    }}})
  });

什么样的语法错误会导致此错误,我该如何解决?

4

2 回答 2

2

嘿,问题在第 21 行。两个参数之间缺少逗号FB.api

FB.api(
  'me/og.likes'
  'post',
  {

应该

FB.api(
  'me/og.likes',
  'post',
  {
于 2013-03-16T21:50:38.740 回答
0

第一行没有美元符号??
你试过这个吗?

$(function(d, debug){
于 2013-03-16T21:51:17.840 回答