homepage Welcome to WebmasterWorld Guest from 54.204.94.228
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
Write out <fb:like> from javascript?
Seattle_SEM

10+ Year Member



 
Msg#: 4276945 posted 2:08 am on Mar 5, 2011 (gmt 0)

I'm doing some ajax, then writing out content via javascript.
If I do something like this in JS:

newcontent += '<fb:like href="http://www.domain.com/url.aspx"></fb:like>';

Then set the innerHTML of a div or something to the value of 'newcontent', nothing happens. I know the rest of the code is working because newcontent contains a whole bunch of other JS and html that's working.

I was able to get the iFrame version of the like to work, but it doesn't seem like I can capture "likes" by using 'edge.create' from an iFrame like, right?

Thanks so much!
-Kevin

 

daveVk

WebmasterWorld Senior Member 5+ Year Member



 
Msg#: 4276945 posted 6:42 am on Mar 6, 2011 (gmt 0)

If the data you are trying to capture is from a different domain than the page/iframe it is going to, the "same origin" policy may be blocking you.

jibbed



 
Msg#: 4276945 posted 9:31 am on Mar 14, 2011 (gmt 0)

It's functioning fine, but you need to parse the new element you've inserted into the DOM:

Use:

FB.XFBML.parse(document.getElementById('theidofthelement'));

after you set the innerHTML

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved