Reputation: 4359
I have a form, well its not really a form because its not wrapped in form tags because I use jQUery to grab the values of each input and pass that off to my ajax page for database processing.
My problem is that I have a <textarea></textarea>
that is pimped out by TinyMCE, How on earth do I grab the content inside the editor so I can send it to my ajax page?
I have an existing script like so
var note = $('.tinymce').val(); //tried .text() too
$.get(url, {
action : 'add',
note : note
}, function(){
alert(note); //to see if data was captured
});
this is not actual code but to show what I have tried so far.
Upvotes: 2
Views: 473
Reputation: 237817
The main thing to note is that TinyMCE takes your textarea and makes an iFrame out of it. You can get the contents of the iframe using the following code:
$('#page_content_ifr').contents()[0].body.innerHTML;
Upvotes: 2
Reputation: 10015
Here is a through explanation how to add AJAX functionality
tinyMCE.init({
mode : "textareas",
theme : "advanced",
save_callback: "sendAjaxRequest"
});
function sendAjaxRequest(){
// ajax stuff here
}
http://wiki.moxiecode.com/index.php/TinyMCE:Turn_tinyMCE_into_an_Ajax_editor
Upvotes: 0