简体   繁体   中英

Express with EJS - Render a function call?

Is it possible to render a function call in express with EJS?

Currently tried:

res.render("page", {
   test: test()
});

Anyone can confirm this is possible or somehow can show, how to call a function from front-end (Public-folder), on page-render?

Please, only show examples in vanilla-JS, not jQuery.

To clarify a little more. I have a Js-file in my public folder, with a function, eg. ./public/js/file.js - with a function called: test() ;

Can I somehow in express with EJS, render the page with a call on test(); ?

我发现不可能在后端的render函数中从前端调用函数作为回调。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM