0
我创建了一个自定义播放器soundcloud's custom javascript plugin,目前一切正常。Soundcloud的自定义播放器在Ajax调用后消失
<a href="http://soundcloud.com/matas/hobnotropic" class="sc-player">My new dub track</a>
但现在,我正在与阿贾克斯的最后一页上加载:自定义播放器,具有单条链路提供的链接,你要包括到您的网页混合或歌曲,例如工程页面加载后,播放器(位于加载的内容中)动态地消失。
由于我不熟悉自定义播放器如何捕获它的数据,这是第一次尝试使用Ajax和pushstate,我试图找出我必须额外添加到我的Ajax的玩会仍然有效。
下面是我使用的AJAX:
$(function(){
var replacePage = function(url) {
$.ajax({
url: url,
type: 'get',
dataType: 'html',
success: function(data){
var dom = $(data);
var title = dom.filter('title').text();
var html = dom.filter('#content').html();
$('title').text(title);
$('#content').html(html);
}
});
}
$('nav a').live('click', function(e){
history.pushState(null, null, this.href);
replacePage(this.href);
e.preventDefault();
});
$(window).bind('popstate', function(){
replacePage(location.pathname);
});
});