Context: I've created a GET request in my route folder that sends html. It will be used for a ajax request:
router.get(url, function(){
res.send("<p>Some Text</p>");
})
My idea/doubt/problem is the following, is it possible to use a partial view in order to generate the html that I want and send it?
I have a partial view with the code i need, that's used in the main rendering, and it's frustrating to edit the code in two different sections.
I've found the way:
res.render(view, function(err, html){
if(!err){
res.send(html);
}
});
If the callback function is used, the default behaviour of rendering the page is canceled.
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.