Reputation: 13
I'm having problems using the Facebook social plugins and javascript pagination inside PHP. It's really odd - what happens is the page loads okay the first time, but then if I choose to go to say a second page the plugins won't load.
I have already added random numbers to the page when it's called by javascript
Display_Load();
$("#content").load("load_page.php?page=1&c_"+(Math.floor(Math.random() * 100000) + 1), Hide_Load());
//Pagination Click
$("#pagination li").click(function(){
Display_Load();
//CSS Styles
$("#pagination li")
.css({'border' : 'solid #dddddd 1px'})
.css({'color' : '#0063DC'});
$(this)
.css({'color' : '#3B5998'})
.css({'border' : 'none'});
//Loading Data
var pageNum = this.id;
$("#content").load("load_page.php?page=" + pageNum + "&c_"+(Math.floor(Math.random() * 100000) + 1), Hide_Load());
and inside the page being called I even tried randomizing the Facebook code:
<div id="fb-root"></div>
<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/sdk.js#xfbml=1&appId=1685492001677633&version=v2.0&c_"+Math.floor(Math.random() * 100000) + 1;
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
I am kind of at a loss here and not quite sure how to proceed.
Thx for your time :)
Upvotes: 0
Views: 136
Reputation: 4908
You have to call FB.XFBML.parse() as described here: https://developers.facebook.com/docs/reference/javascript/FB.XFBML.parse/
The reason for that is it is only when that is called that the facebook tags are replaced with normal html tags. That happens automatically the first time the sdk loads. But when you go to the next page there is nothing that makes sure that that replacement happens.
Upvotes: 1