如何知道在Node.js中按下了哪个“提交"按钮
问题描述:
当用户连接到我的服务器时,如果用户单击,我想显示两种形式,即发送"方法发送到我的服务器的接受"和拒绝".在服务器上处理请求时,如何知道按下了哪个按钮?
When the user connects to my server I would want to display 2 forms, 'Accept' and 'Decline' with post method sent to my server, if the user clicks. How can I know which button was pressed when I handle the request on my server?
答
要发送两个参数,REST URL必须为
In order to send two parameters the REST URL need to be
app.post('buttonclicked/:id/:submit',function(req,res){...}
在客户端,发布网址类似于
and in the Client end, the post url would be like
http://<server domain>/buttonclicked/<id>/<accept/decline>