Answer:
If you use Express (High performance, high class web development for Node.js), you can do this:
HTML:
<form method="post" action="/">
<input type="text" name="user[name]">
<input type="text" name="user[email]">
<input type="submit" value="Submit">
</form>
Javascript:
app.use(express.bodyParser();
app.post('/', function(request, response){
console.log(request.body.user.name);
console.log(request.body.user.email);
});
HTML:
<form method="post" action="/">
<input type="text" name="user[name]">
<input type="text" name="user[email]">
<input type="submit" value="Submit">
</form>
Javascript:
app.use(express.bodyParser();
app.post('/', function(request, response){
console.log(request.body.user.name);
console.log(request.body.user.email);
});
Previous Question | Next Question |
Can we use jQuery with Node.js? | Tell me how to make an HTTP POST request in node.js? |