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! While you're at it, check out some resources Treehouse students have shared here.

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

JavaScript Posting Data with fetch()

karan Badhwar
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
karan Badhwar
Web Development Techdegree Graduate 18,135 Points

return post data

does it always return the data we post or it is just this API, that does that?

Caleb Kemp
Caleb Kemp
12,755 Points

Sorry, I'm a little confused by the question. We can see the data he posted because he used console.log, otherwise the Post data wouldn't have been viewable from the browser. The Post request updated the values of Guil's comments because the server was setup to handle that request. Post comments won't update anything unless the server is configured to accept them. Not sure if that helps, but I tried lol :grinning:

If this still doesn't make sense, perhaps you could clarify the question a little bit? Just thinking out loud.

karan Badhwar
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
karan Badhwar
Web Development Techdegree Graduate 18,135 Points

Hi Caleb Kemp, sorry for the late reply and thankyou for trying, actually what I was saying that, as we POST data so how was he able to get the exact data not the full data back, Coz we are able to console.log, only the data we posted

1 Answer

Caleb Kemp
Caleb Kemp
12,755 Points

Sorry about that, now your question makes sense. Any API could be set up to have that functionality but doesn't have to. Returning the post data is a feature of this particular API. You can hear him mention as much in the video at the 2:02 mark. Hope that helps!