[b]"Struggling with understanding JavaScript POST requests? Need some clarity!"[/b] or [b]"Can someone break down

22 Replies, 1312 Views

Real talk: The confusion with understanding javascript post requests often comes from not seeing the full cycle.

Try this:
1. Use a mock API (like reqres.in).
2. Send a POST request.
3. Check the response in DevTools.

Seeing it live > reading about it.

Also, headers are just rules for the convo between client and server.
"why does everyone talk about JSON.stringify() like it’s magic?"

LOL it’s not, I swear. It’s just how you turn a JS object into a string because HTTP requests only send text.

For understanding javascript post requests, think of it like mailing a letter:
- fetch = envelope
- headers = address/stamps
- body = the actual letter (but it has to be in a language the server understands, hence stringify).

Also, the Net Ninja’s YT tutorial on fetch is 👌.



Users browsing this thread: 1 Guest(s)