So for the record I'm using wordpress but you don't need to know wordpress in order to help me with this. This is my first AJAX attempt and I read through W3schools and understand a good portion of how it works in theory but haven't found any close enough working examples to help me with my issue.
Ultimate goal
Trying scan every X seconds for new post added (through the wordpress). Then with each new post a new div would be added to the page, much like the way Facebook updates when there are new status updates. At the moment I have no results displaying to know how to really proceed with this.
The Code:
News Page.php (summarized)
<script src="http://cdn.jquerytools.org/1.2.5/full/jquery.tools.min.js"></script> // in header
<script>
function updateNews(){
// Assuming we have #shoutbox
$('#liveNews').load('liveNews.php');
$('#liveNews').
}
window.setInterval(updateNews, 3000)
</script>
<div id="content-sidebar-wrap" class="video-featured">
<h4>Recent Newscast</h4>
<div class="wideArea" id="liveNews">
<?php $currID = $post->ID;
$temporary = $wp_query; // set the defined new query
$args = array(
'post__not_in' => array($currID),
'showposts' => '1',
'cat' => '214'
);
query_posts($args);
if(have_posts()) : while(have_posts()) : the_post(); ?>
<div id="video-featured-full-details">
<div id="post-details">
<div id="post-header">
<div id="thumb"><?php echo get_avatar(get_the_author_meta('ID'), 70); ?></div> <!-- #thumb -->
<div id="details">
// CODE HERE
</div> <!-- #details -->
</div> <!-- #post-header -->
</div> <!-- #post-details -->
<div id="clear"> </div>
<?php the_excerpt(); ?>
</div> <!-- END #video-featured-full-details -->
<?php endwhile; endif;
$wp_query = $temporary; //reset it back to normal ?>
<div id="clear"> </div>
</div>
</div>
liveNews.php
<?php $currID = $post->ID;
$temporary = $wp_query; // set the defined new query
$args = array(
'post__not_in' => array($currID),
'showposts' => '1',
'cat' => '214'
);
query_posts($args);
if(have_posts()) : while(have_posts()) : the_post(); ?>
<div id="video-featured-full-details">
<div id="post-details">
<div id="post-header">
<div id="thumb"><?php echo get_avatar(get_the_author_meta('ID'), 70); ?></div> <!-- #thumb -->
<div id="details">
// CODE HERE
</div> <!-- #details -->
</div> <!-- #post-header -->
</div> <!-- #post-details -->
<div id="clear"> </div>
<?php the_excerpt(); ?>
</div> <!-- END #video-featured-full-details -->
<?php endwhile; endif;
$wp_query = $temporary; //reset it back to normal ?>
<div id="clear"> </div>
?>
I don't believe there are any other places I need to be adding code, so now its just a matter of getting these two to communicate properly, and I believe this is more a javascript thing because the ajax portion is just the transfer from what I understand.
Thank you in advance for any help the community here can provide, thank you thank you!
Xtremefaith