为何console.log无法使用了

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
    <input type="text" value="test">
    <input id="submit_button" type="button" value="submit">
    <p id="prompt">test</p>
    <script>    
    function sendData()
    {
        console.log("it is a test");
        var xmlHttp = new XMLHttpRequest();
        xmlHttp.open("post", "test.php",true); 
        xmlHttp.send("iq=test"); 
        xmlHttp.onreadystatechange = function(){        
        if (xmlHttp.readyState == 4 && xmlHttp.status == 200){ 
            document.getElementById("prompt").innerHTML = xmlHttp.responseText;
            }
        }
    }

    ob = document.getElementById("submit_button"); 
    ob.addEventListener("click",sendData);
    </script>

</body>
</html>

test.php如下

<?php
echo "it is a test";
?>

点击button后,我发现 console.log("it is a test"); 没有运行。

图片描述

请问,这是什么原因?

阅读 3.9k
1 个回答

你看看是不是过滤掉了
如果有过滤,把过滤清空,在看看
另外看看显示的等级,选为默认的等级

图片描述

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题