【发布时间】:2019-03-11 12:43:39
【问题描述】:
我是网络语言的新手,所以如果我的问题很愚蠢,请原谅。基本上我正在尝试将数据从html-form 传递到node.js 服务器,但即使在谷歌搜索了很多之后,我也找不到任何相关的例子。那么,谁能帮我学习一下这个东西?
我发现以下示例用于将数据解析到php 脚本,那么我该如何调整此代码以将数据传递给node.js 脚本。
代码:
<!DOCTYPE html>
<html>
<body>
<form action="/action.php" method="get" target="_blank">
First name: <input type="text" name="fname"><br>
Last name: <input type="text" name="lname"><br>
<input type="submit" value="Submit">
</form>
<p>Click on the submit button, and the input will be sent to a page on the server called "/action_page.php".</p>
【问题讨论】:
-
到目前为止你写了哪些服务器端代码?
-
以上代码是客户端的。它将与另一台称为服务器软件的计算机上的一段代码进行通信,该计算机在服务器上运行。 Node.JS 允许快速创建 http(s) 服务器,其中 php 通常作为 apache Web 服务器的一部分作为整个服务器的动态脚本元素执行。总结一下,您将寻找一个 node.js http 服务器示例。
标签: javascript html node.js