So I have a message to be displayed on my html shortly after there's a page redirect. How can I use javascript to achieve this. Basically, I need to know when the current page receives any sort of response, then write a function for that state.
CodePudding user response:
Once you receive the response, if you check the status code you will have some series based on the response, suppose if its success it will be 200 series, and with that you write the logic,
example:
fetch("url").then((response) => {
if (response.status === 200) {
// your function goes here
}
}