admin管理员组文章数量:1414628
I am trying to store my render post table HTML data of just the table into a PHP variable after the table is completely loaded.
I've tried to store:
$table = new Custom_Table_Example_List_Table();
$tablehtml = $table->display();
But this returns an array, not the full rendered table.. (e.g <table>...</table>
).
I have tried using JS var table = $(#tableid").html
and with document.write
to fire, but keeps coming back as undefined. But if I tie it to a click action of a button, the HTML data shows fine.
It may seem as if I would need to capture the data AFTER the system knows that the table and jQuery is loaded fully.
I am trying to store my render post table HTML data of just the table into a PHP variable after the table is completely loaded.
I've tried to store:
$table = new Custom_Table_Example_List_Table();
$tablehtml = $table->display();
But this returns an array, not the full rendered table.. (e.g <table>...</table>
).
I have tried using JS var table = $(#tableid").html
and with document.write
to fire, but keeps coming back as undefined. But if I tie it to a click action of a button, the HTML data shows fine.
It may seem as if I would need to capture the data AFTER the system knows that the table and jQuery is loaded fully.
Share Improve this question edited Sep 12, 2019 at 23:50 Sally CJ 40.3k2 gold badges29 silver badges50 bronze badges asked Sep 12, 2019 at 20:50 samjco-comsamjco-com 5996 silver badges19 bronze badges 3 |1 Answer
Reset to default 0Ah!
function callback($buffer) {
// modify buffer here, and then return the updated code return $buffer;
}
function buffer_start() {
ob_start("callback");
}
function buffer_end() {
ob_end_flush();
}
add_action('wp_head', 'buffer_start');
add_action('wp_footer', 'buffer_end');
本文标签: jqueryStoring current page WP list table HTML data into a PHP variable
版权声明:本文标题:jquery - Storing current page WP list table HTML data into a PHP variable 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745159558a2645377.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
<div id="my-table-wrapper"><?php $table->display(); ?></div>
and usejQuery( '#my-table-wrapper > table' )
to get the table element via JS. (WordPress doesn't add anid
to thetable
tag) – Sally CJ Commented Sep 12, 2019 at 23:53ob_start(); $table->display(); $tablehtml = ob_get_clean();
? – Sally CJ Commented Sep 13, 2019 at 12:09