So, I delete all the content under a specific div and add the contents of the message. However, javascript throws the following error after finishing:
Uncaught Error: NOT_FOUND_ERR: DOM Exception 8
Here is the code in which it is executed
new Ajax.Request("profileThis.php", { method:'post', parameters:{title:title, review:review, userId:userId, category:category, categoryId:categoryId}, onSuccess:function(ajax) { alert(ajax.responseText); // this is just for debugging purposes var message=ajax.responseText; var divMessage=document.createElement("div"); divMessage.style.color="rgb:(105,105,105)"; divMessage.innerHTML=message; while($("reviewSheet").hasChildNodes) { $("reviewSheet").removeChild($("reviewSheet").lastChild); } $("reviewSheet").adopt(divMessage); }, onFailure:ajaxFailure, onException:ajaxFailure });
People noted that the problem is with how I assigned divMessage
to reviewSheet
. I tried both adopt
and appendChild
, but no one works. A little help would be appreciated.
user945221
source share