2010-01-24 43 views
0

我想autorefresh与蓝色的ID每次我用该ID更新帖子autorefresh。 我知道jQuery代码看起来是这样的:自动刷新Wordpress帖子Div

var auto_refresh = setInterval(
function() 
{ 
$('#blue').load('load.php').fadeIn("slow"); 
}, 10000); 

,而不是加载“load.php”我只是想重新加载在其中通过WordPress管理面板外部完成股利的更新内容。任何帮助将不胜感激。感谢大家!

回答

2

这是我的问题太多,一个念头:

您可以创建,加载由WordPress(http://domain.tld/feed/rss/)创建了RSS文件的内容,并提出了新文章的内容与ID XYZ在JavaScript函数使用.html()

function getContent(id) { 
    // Here the Function which loads your RSS File and Match your Content of your Article with the_ID = id 
} 

var content = getContent(<?php the_ID(); ?>); // the_ID() is a WordPress function 

function refresh(content) { 
    $.get(content, function getNew(rssfile) { 
     $("#blue").html(''); 
     $("#blue").html(rssfile); 
    }); 
}; 

$(function(){ 
    refresh(content); 
    var int = setInterval("refresh(content)", 10000); 
}); 

股利蓝色现将我搜索一个其他的想法,但这个例子仅仅是一个想法,因为我还没有找到任何东西如何刷新只需用ID = ID的DIV;

+0

谢谢队友我发现使用wp查询和内容的解决方案。 – CrazyCoderMonkey 2010-01-24 20:57:14

0

要做到这一点的方法是使用外部文件中可以在循环中使用的内容,或者使用wp查询使用循环外部的内容。希望这可以帮助。