jQuery Plugins » used https://jqueryplugins.info jQuery plugins, tutorials and resources Tue, 18 Oct 2011 08:13:27 +0000 en hourly 1 http://wordpress.org/?v=3.2.1 FB is undefined even though I just used it https://jqueryplugins.info/2011/10/fb-is-undefined-even-though-i-just-used-it/ https://jqueryplugins.info/2011/10/fb-is-undefined-even-though-i-just-used-it/#comments Wed, 12 Oct 2011 23:15:34 +0000 Admin https://jqueryplugins.info/2011/10/fb-is-undefined-even-though-i-just-used-it/ Post link: FB is undefined even though I just used it

I am trying to add a Facebook Like button to a widget that I am creating. The code that I use to add the Facebook like button to my page...

]]>
Post link: FB is undefined even though I just used it

I am trying to add a Facebook Like button to a widget that I am creating. The code that I use to add the Facebook like button to my page is as follows:

widget.html

<body>
<div id="fb-root"></div>
<script>
    window.fbAsyncInit = function() {
        FB.init({
            appId  : '263071593731910',
            status : false, // 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>
<div id="fb-button"></div>
<script type="text/javascript" src="widget.js"></script>

widget.js

$  (function(){
var fb = $  (document.createElement("fb:like"));
fb.attr({
    href: data.facebook,
    send: false,
    layout: 'button_count',
    width: 70,
    'show_faces': false
});
$  ("#fb-button").empty().append(fb);
FB.XFBML.parse($  ("#fb-button").get(0));
FB.Event.subscribe('edge.create',changeView);
});

*The changeView function does exist as well in the JavaScript.

When I run the code, I get an error: Uncaught ReferenceError: FB is not defined even though the button is created. The error is pointing to the line containing FB.XFBML.parse code. Is there something I need to do differently in my JavaScript?

newest questions tagged jquery – Stack Overflow

]]>
https://jqueryplugins.info/2011/10/fb-is-undefined-even-though-i-just-used-it/feed/ 0
Parse ANY RSS feed to be used in any way you want, php or ajax part 2 https://jqueryplugins.info/2011/08/parse-any-rss-feed-to-be-used-in-any-way-you-want-php-or-ajax-part-2/ https://jqueryplugins.info/2011/08/parse-any-rss-feed-to-be-used-in-any-way-you-want-php-or-ajax-part-2/#comments Wed, 24 Aug 2011 12:05:36 +0000 Admin https://jqueryplugins.info/2011/08/parse-any-rss-feed-to-be-used-in-any-way-you-want-php-or-ajax-part-2/ Post link: Parse ANY RSS feed to be used in any way you want, php or ajax part 2

Use this simple php file to grab ANY RSS feed and use it, either by way of PHP or by way of ajax and jquery. Grab the files here at...

]]>
Post link: Parse ANY RSS feed to be used in any way you want, php or ajax part 2

Use this simple php file to grab ANY RSS feed and use it, either by way of PHP or by way of ajax and jquery. Grab the files here at optikalefx.com and xml2.txt

]]>
https://jqueryplugins.info/2011/08/parse-any-rss-feed-to-be-used-in-any-way-you-want-php-or-ajax-part-2/feed/ 0