tags:

views:

16

answers:

2

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.

A: 

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

infinity
right, my confusion is that I have like 20 other items other than the note. So I learned that tiny has its own save functions but how do I use that with an existing ajax call?
s2xi
+2  A: 

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;
lonesomeday
oh wow, ya its real late at night, can't believe I forgot about that sort of logic. I did notice that it creates an iFrame but my mind didn't click lol. I can see all that hidden code it ads to my notes hehe. Thanks
s2xi