views:

534

answers:

2

Everytime a page loads I need to load text into the CK Editor using JQuery, in order to get data from CK Editor I use

var editor_data = CKEDITOR.instances['editor1'].getData();

now is there a similar function I could use to put the data back into the editor?

I'm using ajax to set the data like this

$.ajax({

  type: "POST",

  url: "/inc/ajax/basic.php?menu_id="+menu_id+"&info=3",

  success: function(msg){






    CKEDITOR.instances['editor1'].setData(msg);




  }

});

What am I doing wrong

+2  A: 

Try this:

CKEDITOR.instances['editor1'].setData(html)

Where 'html' is a string containing content to edit.

PanJanek
This is the correct thing to do, but it just does not want to work in this case$.ajax({ type: "POST", url: "/inc/ajax/basic.php?menu_id="+menu_id+" } });
Roland
A: 

I hard refreshed the page and then CKEDITOR.instances['editor1'].setData(html)worked ;-)

Roland