2016-11-14 6 views
0

を中華鍋ません。

setInterval(function() { 
    $.getJSON("https://graph.facebook.com/v2.8/?ids=1234567_1234567&fields=reactions.type(LIKE).limit(0).summary(total_count).as(reactions_like)%2Creactions.type(LOVE).limit(0).summary(total_count).as(reactions_love)&access_token=thatsmytoken"), 
     function (res) { 

      console.log(res); 

     }; 
}, 5000); 

だから、GET呼び出して表示し、結果をコンソールではなく、そのべきではありませんが.. Chromeのネットワーク情報でGETの結果が表示されます(5秒ごとに正常に動作します)が、機能内には入っていません。

なぜですか?

+1

'$ .getJSON()'で ')'を閉じることができません。 'encodeURIComponent()'または 'escape()'にURLを渡そうとしましたか? – guest271314

答えて

0

括弧が間違っています。それは次のようになります。それが成功した場合

setInterval(function() { 
    $.getJSON("https://graph.facebook.com/v2.8/?ids=1234567_1234567&fields=reactions.type(LIKE).limit(0).summary(total_count).as(reactions_like)%2Creactions.type(LOVE).limit(0).summary(total_count).as(reactions_love)&access_token=thatsmytoken", 
     function (res) { 

      console.log(res); 

     }); 
}, 5000); 

、機能(RES){...}は、getJSON関数のコールバックとなります。コールバックの詳細については、hereをクリックしてください。

+0

私はダムだ...ありがとう! :) – wiwo

関連する問題