这是html中的形式示例:
CSS3 Contact FormSend an email
Name:
Email:
Message:
这是在服务器上运行的node.js函数:
var sys = require('sys'),http = require('http');
http.createServer(function (req,res) {
switch (req.url)
case '/myaction':
res.end(?????);
break;
}
}).listen(8080);
sys.puts('Server running at http://127.0.0.1:8080/');
我有2个问题:
>如何从html页面调用node.js中的myaction函数?因为html文件在端口80上运行,node.js在8080上运行(当我尝试将node.js移动到端口80时,它写入“//未处理的错误”事件)
>在node.js函数中,我把“?????”如何从html表单获取数据。
当我键入req.html.body.name时,我没有得到数据…