Developers often get confused between readyState and status.
So here I go …
You have a home party in about 1 hour and need to order pizza. Because lets face it, who doesn’t love pizza? You have a lot to do and not much time, so you decide your friend to pick up some pizza on your behalf (hmm), while you stay at home and prepare the table.
In order to make sure you prepare the table in time, you want to keep track of your friend (the “client”) and the pizzeria (the “server”). In other words, you need to keep track of two things:
Has your friend reached the pizzeria successfully and/or is your friend on the way home? (readyState)
Was the pizza made properly? Was the pizza burnt? Did the pizzeria put on the wrong ingredients or do they not have the required ingredients you want? (status)
Bottom line: only if readyState === 4 (your friend is at your home) AND status === 200 (the pizzas were made correctly) does it mean that everything went according to plan. Only now can you enjoy the rest your awesome home party.