Reputation: 55
Iam having a bit of a trouble loading content to CKeditor from within Jquery. I have a list of mail schemas, and for each of thoose i have a edit link, so the user should be able to edit the schema (in CKeditor).
My Jquery looks like this:
$(document).ready(function() {
$(".flip").click(function(){
$("#editor").ckeditor();
$.get("test.php", function(data){
$("#editor").val(data);
});
$(".editMailSchema").slideToggle("slow");
});
});
The html element looks like this:
<div class="editMailSchema">
<textarea id="editor" name="editor"></textarea>
</div>
The element is being Toogled but without the content from test.php. test.php looks like this:
<?php
echo "test";
?>
Could anyone please guide me in the right direction.
Upvotes: 0
Views: 2281
Reputation: 55
I fixed it by editing my jquery code like this:
$(".flip").click(function(){
$("#mailSchema1").ckeditor();
$.get("php/settings/test.php", function(data){
$('#mailSchema1').val(data);
});
$(".editMailSchema").slideToggle("slow");
});
Now it works :)
Upvotes: 1
Reputation: 5933
//for setting or getting the data of the Ckeditor use
// Get the editor data.
var data = $( 'textarea.editor' ).val();
// Set the editor data.
$( 'textarea.editor' ).val( 'my new content' );
Upvotes: 1