WordPress.org

Support

Support » Plugins and Hacks » Facebook » [Resolved] FB Comments AJAX

[Resolved] FB Comments AJAX

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Niall Kennedy

    @niallkennedy

    Are you looking for something such as the Facebook JavaScript SDK’s FB.XFBML.parse() method?

    Yup. Just not quite sure where to integrate it. I imagine it must be in an AJAX call in my theme, but I thought there may be an offhand chance I can include it in the FB plugin files somewhere.

    Plugin Author Niall Kennedy

    @niallkennedy

    The plugin outputs the HTML elements with data-* attributes for interpretation by the Facebook JavaScript SDK. The Facebook JavaScript SDK is then enqueued, loaded asynchronously, and creates the fbAsyncInit JavaScript function referenced by the Facebook JavaScript SDK after it has loaded. Inside the fbAsyncInit function called after the Facebook JavaScript SDK loads is a call to FB.init with xfbml=true, which triggers the FB.XFBML.parse() function against body.

    If the initial pageload passes through WordPress and loads the JavaScript SDK and its init function then you should trigger FB.XFBML.parse() against the root element of your new fragment after it is inserted into the page.

    That’s what I was thinking, but it’s my understanding that an AJAX call will strip out any Javascript in the called fragment. So the parsing command would need to be included in the fragment call.

    Am I on the right track?

    Plugin Author Niall Kennedy

    @niallkennedy

    Depends on your theme or method of loading. You might include a success function, allow plugins to add their own JavaScript calls through an action or something similar.

    I got this working.

    Unfortunately, during the last two updates, something else went wrong.

    Now, the very first comment will not load.

    I.e. when a user makes the first comment–nothing shows up. When the page reloads, the comment shows up–and here’s the tricky part–subsequent comments do appear right away. And deletions also go away immediately.

    This happens when my page is loaded via an AJAX call and when it’s loaded without an AJAX call.

    Any help? Thanks in advance.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Resolved] FB Comments AJAX’ is closed to new replies.
Skip to toolbar