Open a Thickbox with content trough AJAX
I added a custom button to the TinyMCE editor, and I want to open WP's Thickbox when I click on it.
How can I make it so that the tb_show()
function loads the content I want with ajax?
// the ajax
add_action('wp_ajax_getTheContent', 'getTheContent');
function getTheContent(){
echo 'weqwtegeqgr'; // - this should be displayed in the TB
die();
}
Here's some of the editor plugin code I'm using:
init : function(ed, url) {
ed.addButton('do_stuff', {
title : 'Do Stuff',
image : url + '/icon.gif',
onclick : function() {
OpenMyThickbox('do_stuff');
}
});
...
So the OpenMyThickbox
javascript function should do what I want:
function OpenMyThickbox(tag){
tb_show(tag, '...'); // - how to load content trough ajax here ?
}