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);
});
});