一:通过ajax向node后台提交数据过程(附前后台代码),并总结post与get的区别
POST
前台代码
//CSS简单给点样式
<style>
form{
width: 200px;
height: 200px;
margin: 100px auto;
}
#content{
width: 400px;
height: 60px;
border: 1px solid black;
margin: auto;
text-align: center;
line-height: 60px;
border-radius: 5px;
}
#submit{
width: 175px;
height: 30px;
background-color: skyblue;
margin: 20px 0;
border: 1px solid white;
border-radius: 5px;
}
</style>
//HTML
<body>
<div id="content">状态显示框</div>
<form action="http://127.0.0.1:8000/from" method="POST"> //post方式
<label for="login">用户名:</label><br>
<input id="login" type="text" name="user" placeholder="请输入用户名"><br> // label for属性表单绑定
<label for="login">密码:</