I am a beginner with javascript ajax, and all this web stuff.
I have a situation, similar to what was posted (and seemingly solved) in How to insert a a set of table rows after a row in pure JS
In my case, I have xmlhttp.responseText returning a set of TRs from an AJAX call. I need to add it to the end of a table on the page it is called from.
I was using document.getElementById("posts").innerHTML+=xmlhttp.responseText; It worked well on all except IE, and having read into it, I think I understand why (read this).
In your code snippet
function appendRows(node, html){
var temp = document.createElement("div");
var tbody = node.parentNode;
var nextSib = node.nextSibling;
temp.innerHTML = "<table><tbody>"+html;
var rows = temp.firstChild.firstChild.childNodes;
while(rows.length){
tbody.insertBefore(rows[i], nextSib);
}
}
What does node mean? I am trying to find where I can get that in my code.