JavaScript I call from HTML file doesn't work correctly.
Here is code from html file:
<li><a href="#" class="decorNavi" onclick ="xmlRequest('about')" >ABOUT</a></li>
And here is my script:
function xmlRequest(target){
var targetClick;
targetClick = target;
if (window.XMLHttpRequest) {
xmlRequest = new XMLHttpRequest();
}
else{
xmlRequest = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlRequest.open("GET", "targetClick"+".html?="+Math.random() , true);
xmlRequest.onreadystatechange = function(){
if (xmlRequest.readyState == 4 && xmlRequest.status ==200) {
document.getElementById("midContainer").innerHTML = xmlRequest.responseText;
}
}
xmlRequest.send();
}
Can anyone explain me my mistakes? Keep in mind that i'm junior Web Designer, so sorry for lame question.