I have a simple test shown below. It works fine, but for some reason the word "undefined" is appearing in the popup. Nothing is leading me to understanding what is undefined. Has anyone experienced this before?
HTML
<html><head>
<style>#popup{border:1px solid black;background:#eadcce;padding:10px;margin:35px;display:none;}</style>
<script>
function popup(){
var z;
if(window.XMLHttpRequest){z=new XMLHttpRequest();}else{z=new ActiveXObject("Microsoft.XMLHTTP");}
z.onreadystatechange=function(){if(z.readyState==4&&z.status==200){
if(z.responseText != ''){
document.getElementById('popup').innerHTML=eval(z.responseText);
document.getElementById('popup').style.display="block";
}
}}
z.open("POST",'/test2.php');z.send();
}
</script></head><body>
Push the button to open the popup: <button onclick="parent.popup();">Open Popup</button>
<div id="popup"></div>
</body></html>
test2.php
console.log("test");
Everything works great except the word "undefined" appears in my popup. Does anyone know why? I'm using Firefox 55.0.3.