我在TinyMCE编辑器中添加了一个自定义按钮,我想在单击它时打开WP的Thickbox。
我怎样才能使tb_show()
函数使用ajax加载我想要的内容?
// the ajax
add_action(\'wp_ajax_getTheContent\', \'getTheContent\');
function getTheContent(){
echo \'weqwtegeqgr\'; // <- this should be displayed in the TB
die();
}
下面是我正在使用的一些编辑器插件代码:init : function(ed, url) {
ed.addButton(\'do_stuff\', {
title : \'Do Stuff\',
image : url + \'/icon.gif\',
onclick : function() {
OpenMyThickbox(\'do_stuff\');
}
});
...
所以OpenMyThickbox
javascript函数应该执行我想要的操作:function OpenMyThickbox(tag){
tb_show(tag, \'...\'); // <- how to load content trough ajax here ?
}