我在vscode中用preview on web server打开,结果页面显示:Cannot GET /d:/ab/getpost.html 请问是什么原因呢?
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>$.get方法</title>
<script src="script/jquery-3.2.1.min.js"></script>
<script>
$(function(){
$("#send").click(function(){
$.get("get1.txt",
{
username:$("#username").val(),
content:$("#content").val()
},
function(data,textStatus){
$("#resTest").html(data);
}
)
})
/*$("#send").click(function(){
$.get("get2.php",
{
username:$("#username").val(),
content:$("#content").val()
},function(data,textStatus){
var username=$(data).find("comment").attr("username");
var content=$(data).find("comment content")
.attr("content").text();
var txtHtml="<div class='comment'><h6>"+username+
":</h6><p class='para'>"+content+"</p></div>";
$("#resTest").html(txtHtml);
})
})*/
})
</script>
</head>
<body>
<form id="form1" action="#">
<p>评论</p>
<p>姓名:<input type="text" name="username" id="username"/></p>
<p>内容:<textarea name="content" id="content" rows="2" cols="20">
</textarea></p>
<p><input type="button" id="send" value="提交"/></p>
</form>
<div id="resTest"></div>
</body>
</html>
端口被占用了吧