So i have a page that submits a form using ajax and then on success reloads the data/form. When the page initially loads, tinymce loads just fine with the page. When i submit the form, the form reappears but its just a textarea and not the tinymce. I think I have to initialize the tinymce again on success but i have tried and can't seem to get it to work. My Code:
My code:
$.ajax({
type: "POST",
url: "/form.php",
data: datastring,
success: function(data) {
$("#formcontainer").html(data);
tinymce.init({
selector: ".Htmltextarea"
});
},
error: function(){
alert('error handing here');
}
});
});
I also have the tinymce.init on the parent page where the form loads via ajax. Again, when I initially load the form, all works fines, the Tinymce loads. It just when i submit the form via ajax and the success/data is returned that I get the submitted form but the tinymce is gone. How to I get tinymce after ajax form submit? Thannks.
Attempt also not working:
$.ajax({
type: "POST",
url: "/form.php",
data: datastring,
success: function(data) {
$("#formcontainer").html(data);
tinymce.EditorManager.execCommand('mceRemoveEditor', true, ".Htmltextarea");
tinymce.EditorManager.execCommand('mceAddEditor', true, ".Htmltextarea");
},
error: function(){
alert('error handing here');
}
});
});