I used a form form to initiate a get request on a page. After routing, I first rendered and opened a page, and then I needed to execute a $.json() method in the js code of the html page itself. So the question is how to put the form The parameters in the form are passed to the rendered page and then called?
app.get('/testAllData',function (req,res) {
var start=req.query.startTime;
var end=req.query.endTime;
//如何把这两个参数传递到html页面里面?
res.render("testAllData.html");
});
res.render("testAllData.html",{start:start,end:end});
testAllData.html page where parameters are needed, use
<%=start%>
Supplement: The premise of the above writing method is that your express uses ejs as the template engine.
app.engine('.html', require('ejs').renderFile);