发布于 2017-05-21 13:26:17 | 273 次阅读 | 评论: 0 | 来源: 网友投递

这里有新鲜出炉的Node.js教程,程序狗速度看过来!

Node.js 服务器端的JavaScript

Node.js 是一个基于Chrome JavaScript 运行时建立的一个平台, 用来方便地搭建快速的 易于扩展的网络应用· Node.js 借助事件驱动, 非阻塞I/O 模型变得轻量和高效, 非常适合 运行在分布式设备 的 数据密集型 的实时应用


这篇文章主要介绍了Nodejs下用submit提交表单提示cannot post错误的解决方法,非常不错,具有参考借鉴价值,感兴趣的朋友一起看看吧

<span style="font-size:18px;"><form action="/registOK" method="get"> 
<p>用户名:<input type="text" id="userName" name="userName"></p> 
<p>密码:<input type="password" id="passWord" name="passWord"></p> 
<p><input type="submit" value="注册" id="zhuce"></p></form></span> 

我写的注册表单,用post请求提交到registOK页面,提交后提示cannot post错误。用的express模板引擎,代码如下:


app.get("/registOK",function (req,res,next) { 
res.render("registOK"); 
}); 

后来在网上查找发现,路由一般使用“get”就可以,但如果表单提交你指定了“post”,路由上也得加一条:


<span style="font-size:18px;">app.post("/registOK",function (req,res,next) { 
res.render("registOK"); 
});</span> 

ok!问题解决了!



最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务