我试图加载一个PHP页面使用AJAX。问题是,它有一个分享这个按钮,里面使用一个Javascript脚本加载在同一页上。
I'm trying to load a php page with AJAX. The issue is that it has a "share this" button inside that uses a Javascript script being loaded in that same page.
当我加载使用AJAX页面,在分享这个按钮,正确,因为里面的Javascript没有被加载不显示。
When I load the page with AJAX, the "share this" button does not display correctly since the Javascript inside is not being loaded.
我如何可以使页面中的JavaScript加载任何想法?
Any ideas on how I can make the Javascript in the page load?
谢谢, 阿兰·
P.S。 - 我使用jQuery对JavaScript
P.S. - I'm using jQuery for javascript
更新:
我仍然无法得到它的工作。下面是HTML / JS我试图加载:
I still cannot get it to work. Here is the html/js I'm trying to load:
<!-- AddThis Button BEGIN -->
<div class="addthis_toolbox addthis_default_style ">
<a href="http://www.addthis.com/bookmark.php?v=250&username=leblon" class="addthis_button_compact" addthis:url="<?php the_permalink(); ?>" addthis:title="<?php the_title(); ?>">Share
<span class="at300bs at15t_compact"></span>
</a>
<span class="addthis_separator">|</span>
<a class="addthis_button_preferred_1"></a>
<a class="addthis_button_preferred_2"></a>
<a class="addthis_button_preferred_3"></a>
<a class="addthis_button_preferred_4"></a>
</div>
<script type="text/javascript">var addthis_config = {"data_track_clickback":true};</script>
<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#username=leblon" id="the-script"></script>
<!-- AddThis Button END -->
下面是我的JavaScript文件的一个片段:
Here is a snippet of my javascript file:
$.ajax({ url: theURL + link+'/?from=us', success: function(html){
$('#drink').html(html);
}
有人吗?
注册与2007-06-18,似乎它的实现比你有点不同。的
<script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script>
<script type="text/javascript">stLight.options({publisher:'xxx-xxx-xx-xx-xx'});</script>
<span class="st_twitter_large" displayText="Tweet">
</span><span class="st_facebook_large" displayText="Facebook"></span>
<span class="st_ybuzz_large" displayText="Yahoo! Buzz"></span>
<span class="st_gbuzz_large" displayText="Google Buzz"></span>
<span class="st_email_large" displayText="Email"></span>
<span class="st_sharethis_large" displayText="ShareThis"></span>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script tyle="text/javascript">
var addthis_config = {"data_track_clickback":true};
$(document).ready(function(){
$.ajax({ url:'test.php', success: function(html){
$('#content').html(html);
}});
});
</script>
</head>
<body>
<div id="content" style="width:400px;border:1px solid black;height:300px;margin:auto"></div>
</body>
</html>
您可以有一个旧版本和按钮没有被初始化()在执行AJAX的一面。