Hello. What I want to know is the best way to send data to the client and this data will be received through a function (which can be executed in a click).
In the example below I will render a page (I am using express in node.js):
app.get('/exemplo', function (req, res) {
res.render('exemplo.html');
});
But if I want to submit data to the rendered page, will I be forced to use an additional url ? As below:
app.get('/exemplo', function (req, res) {
res.render('exemplo.html');
});
var data = {...}
app.get('/exemplo/data', function (req, res) {
res.send(data);
});
Or could you do both using the same url ? Or would there be some other way to send data, for example, user data to the page, using expressJs .
Note: I do not use the Jade preprocessor.
Thank you in advance.