Facebook JS API Problem


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <div id="fb-root"></div>
  2. <script src="https://connect.facebook.net/en_US/all.js"></script>
  3. <script type="text/javascript">
  4. FB.init({
  5. apiKey: '{APIKEY}',
  6. status: true, // check login status
  7. cookie: true, // enable cookies to allow the server to access the session
  8. xfbml: true // parse XFBML
  9. });
  10.  
  11. function shareFacebook()
  12. {
  13. FB.ui(
  14. {
  15. method: 'stream.publish',
  16. display: 'popup',
  17. message: 'I just sold my books for $5.40 on Cash4Books.net and got FREE shipping! I cleared clutter & made extra cash. It\'s really easy! Sell your books at Cash4Books.net!',
  18. attachment: {
  19. name: 'Sell Books online at Cash4Books.net',
  20. caption: 'Free Shipping',
  21. description: ('Sell your books today for fast cash. We buy textbooks, best sellers, romance novels, cook books, children\'s books, and so much more. Visit Cash4Books.net now & sell your books today! We pay via check or PayPal.'),
  22. href: 'http://www.cash4books.net/index.php?ref=162190',
  23. media: [
  24. {
  25. type: 'image',
  26. href: 'http://www.cash4books.net?ref=162190&utm_source=facebook&utm_medium=facebook%2Bshare&utm_campaign=Facebook%2BWall%2BPost&utm_term=image:Wall%2B Post%2BThumb%2B',
  27. src: 'http://www.cash4books.net/images/turn_books_into_cash.gif'
  28. }
  29. ]
  30. },
  31. action_links: [
  32. { text: 'Sell Books Online', href: 'http://www.cash4books.net/index.php?ref=162190&utm_source=facebook&utm_medium=facebook%2Bshare&utm_campaign=Facebook%2BWall%2BPost&utm_term=bottom%2Blinks:%2BSell%2BBooks%2BOnline' }
  33. ],
  34. user_message_prompt: 'Share your thoughts about Cash4books.net'
  35. },
  36. function(response) {
  37. if (response && response.post_id) {
  38. $('#closeModal').attr('value','done');
  39. }
  40. }
  41. );
  42. }
  43. </script>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.