0

fql クエリを使用して、facebooks グラフ API を簡単に呼び出そうとしています。

$.ajax({
    url: 'https://api.facebook.com/method/fql.query?query=' + encodeURIComponent('select total_count,like_count,comment_count,share_count,click_count from link_stat where url=' + 'http://www.google.se'),
    success: s,
    error: e
});

エラー:Parser error: unexpected ':' at position 97.

URLをエンコードする方法を誰かが説明できますか?

4

1 に答える 1

1

Chrome の Web 開発者コンソールで問題なく動作します。

> encodeURIComponent('select total_count,like_count,comment_count,share_count,click_count from link_stat where url=' + 'http://www.google.se')
> "select%20total_count%2Clike_count%2Ccomment_count%2Cshare_count%2Cclick_count%20from%20link_stat%20where%20url%3Dhttp%3A%2F%2Fwww.google.se"

encodeURIComponentエンコードに失敗したのではなく、コード自体の構文解析エラーのようです。コードを 97 行目あたりに投稿してみてください。コードの 97 行目は正確には何ですか?

于 2013-01-03T00:03:20.317 に答える