I want to load the contents of a partial view (written in Jade) into a Bootstrap modal dialog. For this, I use an AJAX call. I could return only the generated HTML and load it into the modal, but there's additional data I need to get along with the rendered view. I would like to be able to return an object like this (parsed to JSON) :
response = {
some_data: 'blablabla',
some_more_data: [5, 8, 10, 67],
my_html: '<div>HTML rendered from the Jade template</div>'
};
Is there a way to do this? For now I can return the rendered HTML like this :
res.render('employees', {layout: false});
But how can I store it in a variable to return along with more data, without having to do more AJAX calls?