On Wednesday, April 27, 2016 at 5:05:43 PM UTC+2, Sirine Ibn Fraj wrote: > > Hello everyone , > > I am trying to retrieve data from a REST API in the server side (*.js) and > display it in my view (*.jade) > > > I was able to get the data but was not able to send it to the view . > This is how my code looks like : > > > var reqGet = https.request(optionsget, function(res) { > console.log("statusCode: ", res.statusCode); > res.on('data', function(d) { > console.info('GET result:\n'); > > BugData =d ; > console.log(d); > > }); > > }); > > reqGet.end(); > > > BugData (was defined before )is the variable i am trying to send to the > view but for some reasons it is empty and does not contain the variable 'd' > > > Does anyone know why or how can i solve this ? > >
I will assume that your console.log(d) line displays expected results. But there's another question: where is your jade and and how do you call the render function? Without seeing those, especially the part where you call render (together with the BugData part), we cannot help you. -- Job board: http://jobs.nodejs.org/ New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com. To post to this group, send email to nodejs@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/db3f53d0-0c62-4155-afe9-8e0aa0ca1a85%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.