Trevor
Trevor

Reputation: 16116

Adding twitter follow button to page via Ajax call

My Ajax call is generating the following html which creates a twitter follow button and appends it to a div on the page.

<a href="https://twitter.com/@Model.TwitterName" id='followbutton' class="twitter-follow-button" data-show-count="true" data-size="medium">Follow @@@Model.TwitterName</a>

I can't figure out how to get the twitter widget script to work for appended content. If the code is there as the DOM is loading then it works.

Upvotes: 0

Views: 370

Answers (1)

Trevor
Trevor

Reputation: 16116

twttr.widgets.load()

Reloads the script for the html on the page.

Upvotes: 2

Related Questions