如何知道在Node.js中按下了哪个“提交"按钮 [英] How to know which 'Submit' button was pressed in Node.js

查看:57
本文介绍了如何知道在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>

这篇关于如何知道在Node.js中按下了哪个“提交"按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆