0

I use ajax server interval for load new entries, and if I use this method the function return 404 in 30 second.
If I use default link strukture,work fine.
The mod_rewrite is enabled on my server...

The ajax part:

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

</script>

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>

If I not use the ajax,this function work fine.

My htaccess file content:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /test/
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . test/index.php [L]
</IfModule>

# END WordPress

My test site: My test site

(Don't worry the other problem like,the page not load or text bugs thats not important.
This erorr(links erorr) also have on my live site,if I enable the pretty permalinks,but now i disabled)
I dont why not working:D Please help me...

  • Does new.php exist? I'm guessing in the same directory as index.php. Have you tried a full URL in your jQuery? – Twifty Oct 7 '13 at 15:41
  • Yeah,new.php content is "The PHP:" section on my post. And yeah,i try,but nothing change – Szántai Ádám Oct 7 '13 at 15:47
  • Maybe you don't understand. What is the full URL for the page and for new.php? I have a feeling your jQuery is trying to open www.yoursite.com/new.php but it's probably located in your theme/plugin directory. Try using the FULL URL to new.php in your jQuery. – Twifty Oct 7 '13 at 15:52
  • neocsatblog.mblx.hu/test/new.php (thats becouse here the wp-header) – Szántai Ádám Oct 7 '13 at 16:09
  • 1
    Post debugging information and do the right thing and use the AJAX API – s_ha_dum Oct 7 '13 at 16:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.