I am using my node application to extract some data from the API and want to display this data in the view and allow the user to modify it there. I call api and get a JSON response that I would like to pass to the view. That's what I'm doing:
var query = 'SELECT Id, OwnerId, ActivityDateTime, EndDateTime, WhatId, WhoId, Subject FROM Event WHERE OwnerId = \'' + user.userId + '\'' ;
...
...
var ev = resp.records;
res.render('index.html', {eventData : ev});
The problem is that when I want to use the data in my view, I get an undefined error.
If I do this:
<div id='Subject'>#{eventData.Subject}</div>
I get a printout from # {eventData.Subject}
Attempting to use data in JS returns an undefined error:
<script type="text/javascript">
var mydata = #{eventData};
</script>
After some searches, I found a message that suggested to form it first:
var mydata = !{JSON.stringify(eventData)};
console.log(mydata);
Here I get the syntax error "SyntaxError: missing: after property id"
, - , , . , , Jade, Jade "undefined" " ".
... ?
Tnx