我如何用ajax上课?我有这个代码
function parseResponse(request){
if (request.readyState == 4){
if (request.status == 200 || request.status == 304){
var data = request.responseXML;
var header1Name = data.getElementsByTagName('header1') [0].firstChild.nodeValue;
var text1Name = data.getElementsByTagName('text1') [0].firstChild.nodeValue;
var header1Elem = document.createElement("h3");
var header1Text = document.createTextNode(header1Name);
header1Elem.appendChild(header1Text);
var text1Elem = document.createElement("p");
var text1Text = document.createTextNode(text1Name);
text1Elem.appendChild(text1Text);
var existContent = document.getElementById("information");
while ( existContent.hasChildNodes() ){
existContent.removeChild(existContent.lastChild);
}
existContent.appendChild(header1Elem);
existContent.appendChild(text1Elem);
}
}
}
但我完全不知道如何上课,我想将课程附加到 h3 元素,非常感谢任何帮助,我的意思是类<h3 class="class">