Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
339 views
in Technique[技术] by (71.8m points)

php - How to redirect before ajax request success response

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...