I am facing an issue with sending form data to another PHP file. While the process is working, the problem lies in the fact that once the data is submitted, the page does not redirect to the specific page as intended.
It seems like it doesn't work the way it should in PHP.
function codeverify() {
var code=document.getElementById('verificationCode').value;
coderesult.confirm(code).then(function (result) {
if (confirm("OTP Confirmed!")) {
var number=document.getElementById('number').value;
$.post("confirm-phone-reg.php", { status: number }); //send data to file
//document.location.href = "http://localhost/test/new/confirm-phone-reg.php";
} else {
window.location.href = "http://localhost/test/new/try-again.php";
};
var user=result.user;
console.log(user);
}).catch(function (error) {
alert(error.message);
});
}
I am trying to figure out how to ensure that when I send data to confirm-phone-reg.php, the post data and my page will open there correctly. Despite extensive online research, I have been unable to find a solution to this problem. I'm hopeful for some guidance from you guys.