I have this code:
$.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>';
},
});
I have a route in my flask backend /pro_account
that must only accept POST requests, so in success
in the code above I cannot use window.location.href = "/pro_account";
How do I change this part (or the entire code) to make a post request on success to redirect to the /pro_account
URL?