I want to load the new entries without reloading the page.
I found a great solution for:
The ajax script:
<script>
$(document).ready(function() {
var refreshId = setInterval(function()
{
$('#content').fadeOut("fast").load('http://neocsatblog.mblx.hu/new.php').fadeIn("fast");
}, 10000);
});
</script>
And the php:
<?php require_once("wp-blog-header.php"); ?>
<div id="content" <?php cyberchimps_filter_content_class(); ?>>
<?php do_action( 'cyberchimps_before_content'); ?>
<?php if ( have_posts() ) : ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', get_post_format() ); ?>
<?php endwhile; ?>
<?php elseif ( current_user_can( 'edit_posts' ) ) : ?>
<?php get_template_part( 'no-results', 'index' ); ?>
<?php endif; ?>
<?php do_action( 'cyberchimps_after_content'); ?>
</div>
However, this is a special feature that works perfectly here: http://neocsatblog.mblx.hu/test/ However, the main page refuses to load new entries, I do not understand the reason for this, as we use everything the same.
XMLHttpRequest cannot load http://neocsatblog.mblx.hu/new.php. Origin http://www.neocsatblog.mblx.hu is not allowed by Access-Control-Allow-Origin.
You have a cross domain issue which needs to be solved. Using jQuery's load() to pull in cross-domain requests is problematic. See this: stackoverflow.com/questions/3889001/…