开发者

fbml not getting parsed/rendered on ajax response

I am developing a facebook app (using iframe).

I have a situation where my page is fully loaded and it shows the fbml content (request-form) properly, but then on some action, I make ajax call to fetch updated fbml content from server (php). It brings the code, but that fbml is not getting parsed/rendered, and the enclosing div remains blank.

Following is the fbml that i am fetching using ajax:

<fb:serverfbml width="615">
        <script type="text/fbml">
            <fb:fbml>   
                <fb:request-form action="some value"
                                 .......//other code.....>
                        <fb:multi-friend-selector                               
                                .......//other code.....
                                />
                </fb:request-form>
            </fbml>
        </script>
</fb:serverfbml>

After ajax response, the enclosing div remains blank, but in firebug i could see following code in it:

<div id="enclosing_div_id">
<fb:serverfbml width="615"> </fb:serverfbml>
    <script type="text/fbml">
        <fb:fbml>   
            <fb:request-form action="some value"
                             .......//other code.....>
                    <fb:multi-friend-selector                               
                            .......//other code.....
                                 />
            </fb:request-form>
        </fbml>
    </script>
</div>

Though, it's not getting rendered on my page.

Please guide.

Thanks

==============================

UPDATE:

I have checked all of following, but they don't seem to be working in my case.

FB.XFBML.parse();

if ( FB.XFBML.Host.parseDomTree )
    setTimeou开发者_运维技巧t( FB.XFBML.Host.parseDomTree, 0 );


FB.XFBML.parse(document.getElementById('invite_new_div'), function() {
 alert('I rendered');
});

Please note I've not used FBJS in my app so far.


It looks like you're just putting the fbml code into your div and not pulling in the output content which should have been rendered on the facebook server and presented to you as standard html. The browser doesn't know how to render fbml so that is why you just see an empty div.

Update: After you have posted the FB js code it makes sense. According to this artice:

http://developers.facebook.com/docs/reference/javascript/FB.XFBML.parse/

You can only render the following fbml tags:

* fb:activity
* fb:add-profile-tab
* fb:bookmark
* fb:comments
* fb:friendpile
* fb:like
* fb:like-box
* fb:live-stream
* fb:login-button
* fb:recommendations
* fb:serverFbml
* fb:profile-pic
* fb:user-status

As you can see the form element is not listed as one of them. This might be your problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜