Jquery facebook图形类计数调用的编码url
我正在尝试使用fql查询对facebooks graph API进行简单调用Jquery facebook图形类计数调用的编码url,jquery,facebook,Jquery,Facebook,我正在尝试使用fql查询对facebooks graph 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')
$.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错误:位置97处出现意外“:”。
有人能解释一下我应该如何编码URL吗?在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行到底是什么?注意到我遗漏了应该在调用中包装url的引号。谢谢你!