前端页面 .html 生成一个动态模块 Modal
<div class="modal fade" >Send Invite</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal -->
</div>
Jquery提交表单Form
function sendStaffInvite(){ $("#staff-form").submit(); }
Node.js (express框架)后端创建路由 /stores/addstaff
下面代码在routes/stores.js下,可以直接定义addstaff,并接受post请求
app.post(['/addstaff'], function (req, res) { console.log(req.body); });
打印出来req.body 如下图
前端的值已经传入后端 然后可以通过需求写相应功能、写回调函数等等。