Skip to content Skip to sidebar Skip to footer

Post Json Data To Render Page

I am getting my search result as JSON format from the URL: '/accounts/:id/users' and I need to retrieve that JSON data to render '/contacts/find'. (The latter page shows search res

Solution 1:

So accounts is a JSON string? In that case, you can parse it (to convert it back to an object) and pass the result to your template:

var accounts = JSON.parse(req.accounts);
res.render('searchResult.ejs', {
  accounts : accounts,
  email    : accounts.email
 })

Post a Comment for "Post Json Data To Render Page"