Facebook Response Handling jquery
-
Hi All,
I am using contact forms 7 and want to add a facebook field (this is not a specific Q to cf7)
I am doing this by adding a hidden field trying to populate it from the facebook response from sharing a post (FB.UI) using jquery, thats not working so i am trying to open a window after the share to see if its working……i think i may be misunderstanding what the response object is or messing up the code but any help greatly appreicated!!
Ps the code is located just before the footer.php, this shouldn’t matter as it is working with document ready and actions after this?
Also the facebook share is actually posting to facebook!<div id="fb-root"></div> <!-- USE 'Asynchronous Loading' version, for IE8 to work https://developers.facebook.com/docs/reference/javascript/FB.init/ --> <script> window.fbAsyncInit = function() { FB.init({ appId : 'numbers', status : true, // check login status cookie : true, // enable cookies to allow the server to access the session xfbml : true // parse XFBML }); }; (function() { var e = document.createElement('script'); e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js'; e.async = true; document.getElementById('fb-root').appendChild(e); }()); </script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js" type="text/javascript"></script> <script type="text/javascript"> jQuery(document).ready(function(){ jQuery('#share_button').click(function(e){ e.preventDefault(); FB.ui( { method: 'feed', name: 'my story', link: '', picture: 'http:somepicture', caption: 'I will do this', description: 'my lovely description', message: '' } function(response) { if (response && response.post_id) { jQuery(function() { jQuery( "#dialog" ).dialog(); }); } else { alert('Post was not published.'); } } ); }); }); </script> <div id="dialog" title="Basic dialog"> <p>Shared!!</p> </div>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Facebook Response Handling jquery’ is closed to new replies.