我有AddThis js用于将详细信息加入日历.这在页面加载时正常工作,但是我使用ajax加载进行了一些过滤并替换了html,之后AddThis按钮没有显示.这是我的ajax代码.
$('document').ready(function () {
$('.eventSelect').change(function () {
var selectedDate = $('#eventDate').val();
var keyword = $('#eventsearch').val();
var url = "/EventsHome?eventDate=" + selectedDate + "&keyword=" + keyword;
$.ajax({
type: "GET"
, url: url
, success: function (data) {
console.log($(data).find(".eventList").html());
$(".eventList").html($(data).find(".eventList").html());
var script = 'http://s7.addthis.com/js/250/addthis_widget.js#domready=1';
if (window.addthis) {
window.addthis = null;
window._adr = null;
window._atc = null;
window._atd = null;
window._ate = null;
window._atr = null;
window._atw = null;
}
$.getScript(script);
}
, error: function (XMLHttpRequest, textStatus, errorThrown) {
}, comeplete:
Run Code Online (Sandbox Code Playgroud) 基本上,这就是我正在做的事情.用户访问网站,加载"index.html"在index.html中,它会自动通过AJAX将"details.html"加载到DIV中.我在"details.html"上放了一个ADDTHIS按钮.但是,出于某种原因,翻转不起作用.
当我在浏览器中访问details.html时,翻转工作正常.我猜这是因为AJAX?
<a class="addthis_button" href="http://www.addthis.com/bookmark.php?v=250&pub=xa-4adf7e45288f5b21">
<img src="http://s7.addthis.com/static/btn/sm-share-en.gif" width="83" height="16" alt="Bookmark and Share" style="border:0;margin-top:16px;"/></a>
<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pub=xa-4adf7e45288f5b21"></script>
Run Code Online (Sandbox Code Playgroud)