我无法运行Ajax民意调查

https://www.w3schools.com/php/php_ajax_poll.asp

I couldn't run the Ajax survey I found on the link above. Works on site but does not work on localhost. Where am I making a mistake?

<html>
<head>
<script>
function getVote(int) {
  if (window.XMLHttpRequest) {
    // code for IE7+, Firefox, Chrome, Opera, Safari
    xmlhttp=new XMLHttpRequest();
  } else {  // code for IE6, IE5
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
  xmlhttp.onreadystatechange=function() {
    if (this.readyState==4 && this.status==200) {
      document.getElementById("poll").innerHTML=this.responseText;
    }
  }
  xmlhttp.open("GET","poll_vote.php?vote="+int,true);
  xmlhttp.send();
}
</script>
</head>
<body>

<div id="poll">
<h3>Do you like PHP and AJAX so far?</h3>
<form>
Yes:
<input type="radio" name="vote" value="0" onclick="getVote(this.value)">
<br>No:
<input type="radio" name="vote" value="1" onclick="getVote(this.value)">
</form>
</div>

</body>
</html>

</div>

The Post url they used self hosted and all you need to put full url on your request.

xmlhttp.open("GET","https://www.w3schools.com/php/poll_vote.php?vote="+int,true);

@Daniel Smith I tried, but the problem is not related to the PHP file. No function works when radio button is clicked.