Here is the code snippet I am working with:
$.ajax({
type: "POST",
url: "/pro_signup",
data: { data: data, key: key },
dataType: "json",
success: function (response) {
document.getElementById("purchase").innerHTML =
'<button class="btn btn-primary button-connected">Verifying...</button><p class="grey-text">Waiting for verification...</p>';
window.location.href = "/pro_account";
},
error: function (exception) {
document.getElementById("purchase").innerHTML =
'<button class="btn btn-primary button-error">Failed</button><p class="grey-text">Verification has failed.</p>';
},
});
In my Flask backend, I have a route /pro_account
that only accepts POST requests. Therefore, I need to find a way to modify this code so that upon success, it makes a post request to redirect to the /pro_account
URL instead of using
window.location.href = "/pro_account";
Any ideas on how I can achieve this redirection in the code above?