【发布时间】:2021-12-06 09:56:44
【问题描述】:
我有一个带有 express 的虚拟节点 js 服务器,我正在公开一个虚拟的 Index.html,在上面我有一个简单的表单,例如:
<form action="/results" method="post" enctype="multipart/form-data">
<input type="text" name="username" placeholder="Full Name" />
<input type="text" name="email" placeholder="Email" />
<input type="file" name="picture" />
<input type="submit" name="submit"value="picture" />
</form>
当表单提交并且我正在发帖时:
app.post("/results"), function (req, res, next) { }
而不是做经典的 res.send() :
res.send(`
some html with updated data
`)
我只想动态更新/注入 Index.html 元素,而不创建新的 html 模板并添加类似 Hi <span>${req.body.username}</span> <i>your profile image was updated</i> 的内容
这可能吗?
【问题讨论】:
标签: javascript html node.js express ecmascript-6