ajax – 如何重新加载twitter按钮?

前端之家收集整理的这篇文章主要介绍了ajax – 如何重新加载twitter按钮?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
对于ajax页面我打电话:

twttr.widgets.load()

但从未发生过,它不会重新加载twitter按钮.

我也尝试过

twttr.widgets.load(“nameDiv”)

但我得到这个错误

TypeError:对象nameDiv没有方法’getElementsByTagName’

我究竟做错了什么?

解决了这个解决方案(使用jQuery),其他更好的想法?
function tw_reload()  // reload tweet button
{
  $('.social-tw').html('');
  $('.social-tw').html('<a href="https://twitter.com/share" class="twitter-share-button" data-url="' + window.location.href + '">Tweet</a>');
  // refresh the widgets
  twttr.widgets.load();
}
原文链接:https://www.f2er.com/ajax/160003.html

猜你在找的Ajax相关文章