I’m encountering an issue with my webpage where it fails to redirect to the confirmation page, “confirmationRegister”, even after successfully sending data to the database. It’s perplexing because instead of receiving the expected data, I’m encountering errors. This situation has left me feeling quite puzzled and frustrated, as I’m uncertain about the root cause of this unexpected behavior.
I’ve exhaustively attempted various troubleshooting methods in an effort to resolve this issue, but unfortunately, none have proven successful thus far. It’s been a challenging process, as I’ve explored different avenues to pinpoint the underlying problem, but to no avail.
At this juncture, I’m reaching out for assistance in hopes of finding a viable solution. If you have any insights or suggestions on how to troubleshoot or potentially resolve this issue, I would greatly appreciate your assistance. Perhaps you’ve encountered a similar issue in the past or possess expertise in this area that could shed light on the matter.
Thank you in advance for any guidance or assistance you can provide in resolving this perplexing dilemma.
const apiUrl = 'http://localhost:8000';
fetch(`${apiUrl}/users`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(usersData),
})
.then(response => {
if (!response.ok) {
throw new Error(`HTTP error! Status: ${response.status}`);
}
return response.json();
})
.then(data => {
console.log('User added successfully:', data);
if (registerInvalidElement) {
registerInvalidElement.style.display = 'none';
}
window.location.href = '/confirmationRegister';
})
.catch(error => {
console.error('Error adding user:', error);
if (registerInvalidElement) {
registerInvalidElement.style.display = 'block';
}
});```
I tried eveything to solved it, but it still do not works.
Help help help help help
Dawid Maciejewski is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1