Background: If is post a form, the process is of 4-5 minutes. And I can't wait for that process. I don't need a response from the server. So I want the process should be handled by the server at the backend, the user should be redirected to another page after submitting the form.
Here is my code.
$("form#form").submit(function(e) {
e.preventDefault();
var formData = new FormData(this);
var call = $.ajax({
url: '',
type: 'POST',
data: formData,
async: true,
cache: false,
contentType: false,
processData: false
});
window.location.replace("http:localhost/members/maga-process.php");
});
Problems to handle:
- the user just clicks to submit the form. and a post request should be sent to a URL and the user is redirected to another page without waiting for success response(because the process is of 4-5 minutes).
question from:
https://stackoverflow.com/questions/65856488/how-to-redirect-before-ajax-request-success-response 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…