• Resolved jonsonw

    (@jonsonw)


    Hi,

    Great plugin,

    I want to AJAX load post with table in it, but it doesn’t works, how to achive it? the server code in the functions.php of theme as belows:

    function load_post() {
    if(@$_REQUEST[‘action’] == ‘load_post’ && @$_REQUEST[‘id’] != ”) {
    $id = $_REQUEST[“id”];
    query_posts(“p=$id”);
    the_post();
    the_content();

    die();
    }else{
    return;
    }
    }
    add_action(‘init’, ‘load_post’);

    http://wordpress.org/extend/plugins/tablepress/

Viewing 1 replies (of 1 total)
  • Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    thanks for your question.

    One problem here might be the file that you are using for the AJAX request. Is that a custom PHP file in your theme/plugin? Or are you using an existing file like admin-ajax.php (that is the recommended way).

    The next problem might be the time of when you fire your code. By using the init hook, you have no guarantee that TablePress (or other plugins) have run, as they also use the init hook. Thus, you might have to choose a lower priority or switch to a hook that is evaluated later.

    Regards,
    Tobias

Viewing 1 replies (of 1 total)
  • The topic ‘How to show the table when using Ajax load post?’ is closed to new replies.