How do I get the contents of a nicEdit form when submitting trough ajax?

Rovanion picture Rovanion · Mar 6, 2011 · Viewed 31k times · Source

So what I want to do is to submit a form using jQuery's AJAX function. And the route I choose to go was to use $('#form').serialize(); and then pass that as a GET request. It works out all dandy and fine and dandy until I add the editor, NicEdit, that I'm going to use on the site.

I've researched the issue and the situation is so that once NicEdit takes over a text-area for example, it hides the text-area to the user and instead has her write into a . This data will then be put back into the text-area triggered by the push of a normal submit button.

Now the issue is: I don't have a normal submit button and hence don't trigger the event that puts the data back in the text-area. And I have tried my best to solve the issue google a solution but everything I've found has been worthless.

Given the fallowing basic setup of my situation: http://jsfiddle.net/MMzhS/1/ - How would you get the data from the NicEdit form to the text-area before alert(); is called?

Answer

Sunu Pinasthika Fajar picture Sunu Pinasthika Fajar · Dec 15, 2011
var nicE = new nicEditors.findEditor('assignment');
question = nicE.getContent();

'assignment' is your textarea id.

the textarea content is save on question variable, hope this will help