954,561 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

WYSIWYG Editor Not Loading the AJAX text (fetched from another page) ,

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();
		  }
		else
		  {// code for IE6, IE5
		  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		  }
		xmlhttp.onreadystatechange=function()
		  {
		  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;
			
			overlay();
			
			}
		  }
		xmlhttp.open("GET","get_page_data.php?page_id="+page_id,true);
		xmlhttp.send();
		
		
	}

</script>


.

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 tag then its showing the data perfectly fine. Please help me out with this.

Thank you.

Jay-Kandari
Newbie Poster
4 posts since Dec 2011
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: