Ajax and CodeMirror Textarea

I have a textarea where i get userinput, and i have another textarea where an ajax response would be dumped. Onclick of a button, the ajax code gets the userinput, sends it to a php page and is supposed to put the reply in a textarea box but instead, it creates a new textarea but doesn’t delete the old one.

function compile() {
var usercode = document.getElementById(“textareaa”).value;
var response2 = document.getElementById(“serveResponse”);
var editor = CodeMirror.fromTextArea(response2);
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if(this.readyState == 4 && this.status == 200) {
} else {
alert(“Did’t get a reply, or something is wrong” + this.responseText);
var data = “code=” + usercode;
xhttp.open(“POST”, “test.php”, true);
xhttp.setRequestHeader(“Content-Type”, “application/x-www-form-urlencoded”);

// Just debugging here
editor.setValue(“maybe processing”);

Never mind, Solved it.