无法检测到ajax中的文件

Hey guys am new to ajax I have a php file and a ajax file. I just want to detect the php file from the ajax so I have send a request in ajax like

<!DOCTYPE html>
<html>
<head>
<script>
function loadXMLDoc()
{
var xmlhttp;
if (window.XMLHttpRequest) {
  xmlhttp=new XMLHttpRequest();
}
else
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
  xmlhttp.onreadystatechange=function()
{
   if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
    alert(xmlhttp.responseText);
  } else {
 console.log('file not fetched');
}

xmlhttp.open("GET","first.php?m=babe",true);
xmlhttp.send();
}
}
loadXMLDoc();
</script>
</head>
<body>
</body>
</html>

My php file

<?php
include("ajax.html");
$p = $_REQUEST['m'];
if($p == 'babe') {
    echo true;
}

When I run the ajax.html on localhost it doesn't show me any message in the window nor in the console.

Can you guys tell me why is it like this?

Thanx for the help

Some of your brackets were wrong:

function loadXMLDoc(){
var xmlhttp;
if(window.XMLHttpRequest){ // This bracket was missing
  xmlhttp=new XMLHttpRequest();
}
else{ // This bracket was missing
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function(){
  if(xmlhttp.readyState==4 && xmlhttp.status==200){
    alert(xmlhttp.responseText);
  }
  else{
    console.log('file not fetched');
  }
} // This bracket was on the wrong place (it enclosed the .open() and .send())

xmlhttp.open("GET","first.php?m=babe",true);
xmlhttp.send();
}

loadXMLDoc();

Also, a simpler way of defining the callback function is:

xmlhttp.onload=function(){
  if(xmlhttp.status==200){
    alert(xmlhttp.responseText);
  }
  else{
    console.log('file not fetched');
  }
}