i am working with ckeditor.I used ajax to send the content of the ckeditor using post method.My plan is to show the response in a div .But in response i get the html for the whole page enclodes by html tag instead of only the editor's content.What is going on here? How can i get only the editor's content
<?php
if(isset($_POST) && !empty($_POST)){
echo $_POST['content'];
}
?>
<html>
<head>
<script src='ckeditor/ckeditor.js'></script>
</head>
<body>
<form action='test.php' method='post'>
<textarea name="editor1" id="editor1" rows="10" cols="80">
This is my textarea to be replaced with CKEditor.
</textarea>
<input type='button' value='submit' onClick='lol(event);'>
</form>
<div id='content' style='border:2px solid black;'>
</div>
<script>
CKEDITOR.replace( 'editor1');
function lol(event){
var xhr=new XMLHttpRequest();
xhr.onreadystatechange=function(){
if(xhr.readyState==4 && xhr.status==200){
//document.getElementById('content').innerHTML=xhr.response;
alert(xhr.responseText);
}
}
var value=CKEDITOR.instances.editor1.getData();
var params = "content="+value;
xhr.open('POST','test.php',true);
//xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhr.send(params);
//alert(value);
}
</script>
</body>
</html>