I am using oembed in the Twitter API to embed a tweet widget. It gets the JSON response just fine, but it shows the tweet in text only, not the embedded widget response. The javascript that Twitter sends is not firing.
$(document).ready(function()
{$.getJSON("https://api.twitter.com/1/statuses/oembed.json?id=133640144317198338&align=center&callback=?", function(data)
{$('#target').html(data.html);
});
});
then for the html:
<body >
<div id="target"></div>
</body>
=================================================================
Response comes formatted in text only version, instead of the widget.
I was stuck with this as well. If you don't want to deal with jquery you can just use
<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
and then put into html:
<blockquote class="twitter-tweet"><a href="http://twitter.com/coffee_dad/status/287348974577385474">link</a></blockquote>
I'm not sure if this is the proper way, but it seems to work for me.
I had the same problem. The dynamically loaded blockquote
from oembed
won't get rendered. After digging into widget.js
, I found that you just need to call twttr.widgets.load()
after you have added new blockquote
into your page. Enjoy!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With