I have the following .js get route server
app.get('/', function(req, res) { var url; var final_res = []; endpoints.forEach(function(url){ request(url, function(error,response,body){ if(!error && response.statusCode == 200){ final_res.push(url.url); console.log(url.url); }else{ res.send(err); console.log(err); } }); }); });
And this is my js client where I get this exact result with jQuery
$(document).ready(function() { $.get('http://localhost:3000/', function(data) { console.log(data); $("#body").text(data); }); });
When I open my index.html, it displays the user interface correctly and inside my terminal, where I execute my server.js, it displays the URL correctly. What I cannot do is use my data that my jQuery gets to populate the table inside my html. My table will be populated with URLs that are extracted from my endpoints.
I have some background in nodejs but I can't wrap it.
source share