Jay-Kandari 0 Newbie Poster

Hey guys,

Was really fed up with this problem .please check it out.

I have a PHP page which calls and retrieves a text from other PHP page. Now using the Normal textarea element the value is showing in the textarea.

Now I wanted that text area to be as WYSIWYG editor for that I used nicEdit.js Editor. (although I tried many). The reason for putting this because to give proper HTML formatting to my text.

The Problem with this Editor is the value fetched by the AJAX query is not getting shown in the Editor

Here's the code

<script type="text/javascript">	
	function view_page(){
		overlay();// used to show a modal dialog.
		page_id = document.getElementById('sel').value;
		if (window.XMLHttpRequest)
		  {// code for IE7+, Firefox, Chrome, Opera, Safari
		  xmlhttp=new XMLHttpRequest();
		  {// code for IE6, IE5
		  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		  if (xmlhttp.readyState==4 && xmlhttp.status==200)
//Next Line inserts the text into the <textarea name="texts"> named texts.
			document.getElementsByName('texts').item(0).innerHTML = xmlhttp.responseText;

			document.getElementsByName('page').item(0).value = page_id;



Here Everything is working fine. The Only problem is that the WYSIWYG editor is not loading the text from the AJAX (.innerTHTML() method).

* Note: if I'm using the normal <textarea> tag then its showing the data perfectly fine. Please help me out with this.

Thank you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.