Reputation: 35213
I'm trying to make a simple call to facebooks graph API using an fql query.
$.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
});
Error: Parser error: unexpected ':' at position 97.
Can someone explain how I should encode the URL?
Upvotes: 0
Views: 224
Reputation: 4928
Works fine for me on Chrome's web developer console:
> 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"
Sounds like it might not be encodeURIComponent
that failed to encode, but rather a syntax parsing error in your code itself. Mind posting the code around line 97 and what exactly is on line 97 of your code?
Upvotes: 1