How is it possible that the function of the test page works, but it does not go live?

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:

Read More
<?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.

Related posts

2 comments

  1. Try changing your script to this since you’re not actually running a cross-browser request:

    <script>
    (function($) {
      $(document).ready(function() {
        var refreshId = setInterval(function()
        {
          $('#content').fadeOut("fast").load('/new.php').fadeIn("fast");
          $("#content .span9 article").unwrap();
        }, 10000);
      });
    })(jQuery);
    

    UPDATE: Wrapped in WP-friendly jQuery no-conflict code…

Comments are closed.