0
我有设置以下路线:传递数据,快速和EJS
router.get('/', function(req, res) {
res.render('index', {});
});
router.post('/application', function(req, res) {
res.render('application', {twitchLink : req.query.twitchLink});
});
我有两个观点正确设置。
这是我在“索引”已经得到了看法:
<form class="form-horizontal" action="/application", method="post", role="form">
<input type="url" name="twitchLink" required>
<button class="btn btn-success">Submit</button>
</form>
提交这份表格,并带我到应用程序视图。
<script>var twitchLink = <%- JSON.stringify(twitchLink) %></script>
<script>console.log(twitchLink)</script>
这应该注销我提交的链接,对不对? 不过,我得到以下两行:
Uncaught SyntaxError: Unexpected end of input
Uncaught ReferenceError: twitchLink is not defined