I've been trying to figure this out long enough that I think i've confused myself at this point.So, my server is sending json to the client...var jsonToSend = JSON.stringify(body); res.json(jsonToSend); when I go to the route i'm usingapp.get('/yoyo', function(req, res) { it displays the json there, in string form of course.What I want to do is receive that json in my client side js as a variable, through XHR, and then parse and inject certain values into my html. I want to do this at my homepage ( app.get('/', ...) , I'm also serving static files at this route.I've used XHR to read files (.json, .txt), but I'm confused or just don't understand how I can, or if I can, use XHR to basically receive that JSON that is being sent by the server. Is it just about the URL In use in my open function within the XHR request?Thanks for your time!
Submitted January 04, 2019 at 01:17PM by Grizz_lee
No comments:
Post a Comment