Agregué un botón personalizado al editor TinyMCE, y quiero abrir Thickbox de WP cuando hago clic en él.
¿Cómo puedo hacer que la función tb_show()
cargue el contenido que quiero con ajax?
// the ajax
add_action('wp_ajax_getTheContent', 'getTheContent');
function getTheContent(){
echo 'weqwtegeqgr'; // <- this should be displayed in the TB
die();
}
Aquí está el código del complemento del editor que estoy usando:
init : function(ed, url) {
ed.addButton('do_stuff', {
title : 'Do Stuff',
image : url + '/icon.gif',
onclick : function() {
OpenMyThickbox('do_stuff');
}
});
...
Entonces la función OpenMyThickbox
javascript debería hacer lo que quiero:
function OpenMyThickbox(tag){
tb_show(tag, '...'); // <- how to load content trough ajax here ?
}