WordPress.org

Support

Support » Plugins and Hacks » Hacks » jQuery UI Tabs – Ajax – PHP … 404

jQuery UI Tabs – Ajax – PHP … 404

  • i don’t know if it’s already asked but i cannot find with search here and on search engine..

    the html

    <div id="tabs">
      <ul>
        <li><a href="call.php?catid=0">Tab1</a></li>
        <li><a href="call.php?catid=3">Tab2</a></li>
        <li><a href="call.php?catid=8">Tab3</a></li>
        <li><a href="call.php?catid=6">Tab4</a></li>
      </ul>
    </div>

    the javascript

    jQuery("#tabs").tabs({
      ajaxOptions: {
        error: function(xhr, status, index, anchor) {
          jQuery(anchor.hash).html("Couldn't load this tab. We'll try to fix this as soon as possible.");}}});

    call.php

    define('WP_USE_THEMES', false);
    require '../../../wp-blog-header.php';
    $cat = (int) $_GET['catid'];
    $args = array ('numberposts' => '5', 'post_type' => 'post', 'suppress_filters' => 0, 'category' => $cat);
    $recent_posts = wp_get_recent_posts($args);
    foreach ($recent_posts as $recent):
    if (has_post_thumbnail($recent['ID']))
    $fpimg = get_the_post_thumbnail($recent['ID'], 'fpslide', array ('title' => esc_attr($recent['post_title'])));
    else
    $fpimg = '<img src="'.get_template_directory_uri().'/image/logo-slide.jpg" alt="" title="'.esc_attr($recent['post_title']).'" />';
    ?>
                        <a href="<?php echo get_permalink($recent['ID']);?>"><?php echo $fpimg;?></a>
    <?php endforeach;?>

    the problem is i can’t get the content, always show the error msg (“Couldn’t load this tab….”).
    on firebug the status say 404, but on Response & HTML tab i can see the right content.. so what did i do wrong?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Did you find a solution for this problem? I can’t get a wordpress function to work inside a ajax loaded .php files. Always get the error “Couldn’t load this tab.. bla bla”…

    Does anyone have an answer ! I have the same issue as you selera !

    Alright I found the answer ! Instead of :

    define(‘WP_USE_THEMES’, false);
    require ‘../../../wp-blog-header.php’;

    Write :
    require ‘../../../wp-load.php’;

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘jQuery UI Tabs – Ajax – PHP … 404’ is closed to new replies.