careerbydoing
← Web development

Web development

Which method sends your answer

About 2 min if you have seen this material before, 8 min or so if it is new to you.

Background
Everything on the web is one Every web interaction is a request from the browser and a single response from the server.: the browser sends a method, a path, headers, and optionally a body; the server sends back a status code and a body. Nothing else is going on underneath. The method declares intent, and browsers and caches act on that declaration. GET means "retrieve something, change nothing": its data rides in the URL, and it may be cached, bookmarked, prefetched, or replayed when someone hits the back button. POST means "here is data that changes something": the data rides in the request body and is not cached. Choosing wrongly is not a style error: a GET that mutates state will eventually be triggered by a crawler that was only trying to look.
On a problem page, you type an answer and click Submit. The browser sends the answer to the server to be graded. Which HTTP method does that request use?

Past 25 min on this? That usually means a missing prerequisite rather than a lack of effort — worth reading up before pushing further, starting with HTTP request methods (MDN).

Want to go deeper?