I am using nicedit plugin in php file and it is working fine.
<script type="text/javascript" src="http://js.nicedit.com/nicEdit.js"></script>
<script type="text/javascript">
bkLib.onDomLoaded(function() {
new nicEditor({buttonList : ['fontSize','bold','italic','underline','ol','ul','strikeThrough','subscript','superscript','forecolor','bgcolor']}).panelInstance('area4');
nicEditors.findEditor('area4').saveContent();
});
</script>
I want to put some value in nicedit editor from database by ajax. Here is the ajax code.
<script type="text/javascript">
$(function() {
$("#autofill").change(function() {
var data1= $('option:selected', this).text();
$.ajax({
type: "GET",
url:"autofill.php",
cache: false,
data: 'action1=' + data1,
beforeSend: function() {
$("#validation-errors").hide().empty();
},
success: function(data) {
if(data.success == true)
{
data = JSON.parse( data );
$('#area4').val(data.title);
$('html, body').animate({scrollTop: $("#features-left-image").offset().top}, 2000);
}
},
error: function(xhr, textStatus, thrownError) {
alert('Something went to wrong.Please Try again later...');
btn.button('reset');
alert(thrownError);
}
});
return false;
});
});
</script>
I checked and found json data is returning from autofill.php but for some reason i am not able to show them in nicedit editor. If i use textbox instead of nicedit then data is showing there but it is not working for nicedit textarea.
Have you ever face similar issue?
Thanks for your time.
Finally i got it working. Here is the code.
var ed=data.title;
nicEditors.findEditor('area4').setContent(ed);