1

I am trying to load a #content div of news_092612.html into another page using jquery. Everything from #content is loading fine except for the facebook like button. Here is the script I am using, I believe I am supposed to incorporate a parse function somewhere to get the buttons to reload in the new #newswrapper. I've searched and tried, but I'm hitting a wall. Thanks in advance!

 $(document).ready(function(){ $('#newswrapper1').load('news_092612.html #content'); }); 

Also here is the original page that I'm getting #content from. http://www.spadeballink.com/GALLOWS/news_092612.html

As well as the other page that I'm trying to load #content to. http://www.spadeballink.com/GALLOWS/TheGoddamnGallows.html

1 Answer 1

1

This is because the Facebook widget is loaded by the Facebook SDK, which is included in the specific news file, but not the page you're trying to load your #content div into.

Try adding this code into the page gallows.html page:

<script> (function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/all.js#xfbml=1"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk')); </script> 
Sign up to request clarification or add additional context in comments.

3 Comments

That worked like a charm! Thank you so much, I should have just asked a week ago and saved the headache! Haha
You may also want to look at bringing in the FB metadata from the posts as well, they're the og pieces. They help with the sharing process, and so much more.
Thanks! I'll definitely do that. I'm hoping you can help with another problem that has arose. The container (#newswrapper1) div is not resizing when the facebook buttons are clicked. I have searched and tried everything I thought would work to no avail. Thanks for anymore input!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.