Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Michael Paccione
Michael Paccione
9,017 Points

How to get API data from NodeJS to ultimately display in the DOM?

So I completed the NodeJS Basics course and then went off to create a weather forecast webpage. I am able to get the data from the API but how then do you display it onto a webpage?

1 Answer

Hey Michael, you would most likely use javascript in the browser to append it to the document. You're generating that server side API but you'll need to retrieve it as normal.

So assuming you're using jQuery (all psuedo code of course).

$.get(yourapiurl, function(data){ var myinfo = data.results; });

$('div').html = data.results;

Good luck!