Support » Everything else WordPress » Loop within ajax-fetched fragment returns server error.

  • I’ve been testing towards conditionally delivering a sidebar.
    The sidebar contains a minimal testing loop that lists latest posts.

    If I include my loop code in a test page, it works just fine. This is the code I have:

    <section id=”sidebar”>
    <?php if ( have_posts() ) : while ( have_posts() ) :
    the_post(); the_title(); the_content();
    endwhile; endif; ?>

    However, if I put this code into it’s own file (sidebar.php) and then request sidebar.php via an ajax request from javascript, I get a bad result:

    In the resulting page source I can see <section id=”sidebar”>, but not the rest of the sidebar code.

    In firebug, I can see that the request has resulted in an internal server error. (I’m developing on apache)

    Why could this be going wrong?

    Is there something I need to know about loop code inside ajax fragments?

  • The topic ‘Loop within ajax-fetched fragment returns server error.’ is closed to new replies.