我尝试了以下方法,但如果我正在加载的页面有javascript,它将不会运行,因为元素是在页面加载后创建的。当javascript是我编写的东西时,我只需在load()之后再次调用该函数就可以了,但是我能为页面上的插件做些什么呢?比如联系方式等?
在wordpress中进行ajax调用以使我的rest javascript不会停止的正确方法是什么?谢谢
$(\'#subpage_arrows a\').live("click", function(){
$(\'.content_inside\').wrap(\'<div id="ajax_content" />\');
$(\'#ajax_content\').css(\'height\',$(\'.content_inside\').height());
var toLoad = $(this).attr(\'href\')+\' .content_inside\';
$(\'.content_inside\').fadeOut(\'fast\',loadContent);
$(\'#load\').remove();
$(\'#content\').append(\'<div id="load">Loading...</div>\');
$(\'#load\').fadeIn(900);
window.location.hash = $(this).attr(\'href\').substr(0,$(this).attr(\'href\').length-5);
function loadContent() {
$(\'#ajax_content\').load(toLoad,\'\',showNewContent());
}
function showNewContent() {
$(\'#ajax_content\').hide().fadeIn(1000,hideLoader()).css(\'height\',\'auto\');
}
function hideLoader() {
$(\'#load\').fadeOut(\'normal\');
}
return false;
});