Matthew Stringer
Matthew Stringer

Reputation: 11

Approved graph action does not work

I've struggled with this for hours... new to creating graph actions... why doesn't our approved graph action work? We expect that when a user clicks the "Click Here!" button that it will show that they've scheduled a blood donation on their timeline. We have a form button coded precisely as outlined in the FB tutorial, and it's on a page tab we've added to a page, but nothing happens when you click the "Click Here!" button.

The page tab in question -> http://www.facebook.com/cityofhope.donateblood/app_323470837712150

Here's the code:

<script type="text/javascript">
  function postSchedule()
  {
   FB.api(
    '/me/cohblooddonor:schedule',
    'post',
    { blood_donation: 'http://www.cityofhope.org/giving/Documents/blood-donor.html' },
    function(response) {
       if (!response || response.error) {
          alert('Error occured');
       } else {
          alert('You've shared with your friends! Action ID: ' + response.id);
       }
    });
 }
 </script>

And the button:

<form>
<input type="button" value="Click here!" onclick="postSchedule()" />
</form>

Any help is appreciated! I've been going at this for hours. Is it an authentication issue? thanks in advance!

Upvotes: 0

Views: 44

Answers (1)

cpilko
cpilko

Reputation: 11852

You've got a syntax error due to mismatched quotes on line 58 of your source: 'You've ...'

You could escape the literal apostrophe with a backslash, or change "You've" to "You have".

You also have a few other errors on the page. Check these out using the Javascript console on a modern browser.

Upvotes: 2

Related Questions