cleditor/cleditor — Issue #18: Load text into CLEditor via ajax call
Author: Nicero
Created: 2012-02-05 18:23:23+00:00
State: open

I would like to load some text retrieved from a dB into a CLEditor driven textarea.

The user clicks a link:

JQuery passes the ID to GO.PHP:

$(".editlink").click(function() {
$.get("go.php", {param: $(this).attr('id')},
function(data) {
$(#area1').html(data);
});
return false;
});

GO.PHP retrieves the text from the dB:

$qry = mysql_query("SELECT * FROM reviews WHERE id = ".$_GET['param']." ");
while($review = mysql_fetch_array($qry)) {
echo $review['description'];
}

and the HTML:

As confirmed by Firebug consolle, ID and the text are retrieved correctly. The problem I noticed is that when CLEditor is active, loaded and working I need to refresh the page to see the text loaded into the textarea. If CLEditor is not loaded, the text is loaded via ajax suddently without any page refresh.

I did read about :

editor.$area.val(htmltext);
editor.updateFrame();

but as I'm still learning jQuery would someone be so kind to add these two lines into my above code?