FB.API 'Undefined' : news.reads activity

I'm trying to implement the Facebook news.reads App - I'm just missing one final step - executing the POST to FB. When I look at the Firebug console, it appears that the POST is in fact working...or at least there are no errors. Check out the output below:

Post:


__a 1
__user  myID
app APPID
fb_dtsg AQBi1J4k
href    http://www.around-around.com/today-show/
phstamp 1658166105497452107119
ref 
Source
fb_dtsg=AQBi1J4k&href=http%3A%2F%2Fwww.around-around.com%2Ftoday-show%2F&app=183125741799131&ref=&__user=63802158&__a=1&phstamp=1658166105497452107119

(I've validated that the meta data from the URL is correct).


But the response I get from FB is strange:


for (;;);{"__ar":1,"payload":null}


No idea what to do with that. The referrer also seems to be the recommendation bar (which I'm using):

https://www.facebook.com/plugins/recommendations_bar.php?action=like&api_key=APPID&channel=http%3A%2F%2Fstatic.ak.facebook.com%2Fconnect%2Fxd_arbiter.php%3Fversion%3D11%23cb%3Df274495fd8bd4fc%26origin%3Dhttp%253A%252F%252Fwww.around-around.com%252Ff2b573e1404fec4%26domain%3Dwww.around-around.com%26relation%3Dparent.parent&href=http%3A%2F%2Fwww.around-around.com%2Ftoday-show%2F&locale=en_US&num_recommendations=2&read_time=30&sdk=joey&side=right&site=around-around.com&trigger=onvisible

So, I'm also using this code to try to automatically force a POST news.reads action.

<script type="text/javascript">
  function readArticle()
  {
      FB.api(
        '/me/news.reads',
        'post',
        { article: '<?php the_permalink(); ?>' },
        function(response) {
           if (!response || response.error) {
              alert('Error occured');
           } else {
              alert('Article read was successful! Action ID: ' + response.id);
           }
        });
  }
  </script>

(you won't see this code on the site, as it's only firing for admins as of now)

I'm not getting any alerts so something is causing this to misfire...but using the recommendation bar would be preferable to us.

Anyways, any help would be appreciated.

Luke

Answers


Need Your Help

Limit/Count number of chracters in TextArea using jquery

jquery count textarea

How to count the characters what entered in text area box?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.