How to do two POST requests for visitors with JS disabled on one submit button?

前端 未结 4 1091
醉话见心
醉话见心 2021-01-15 08:12

I got help with solving a problem in this thead: Redirect with POST data. Now that I decided that the whole site and even this function must work when JS is disabled I need

4条回答
  •  迷失自我
    2021-01-15 08:30

    If you want to make the browser to re-send the data of a HTTP Post request to another URI, the HTTP/1.1 protocol offers the 307 (temporary redirect) response status code to signal such to the HTTP-client (Browser):

    header('HTTP/1.0 307 Temporary Redirect',$replace=true,307);
    header('Location: some_new_url_here');
    

    Read the specs carefully and see the notes on the 302 status as well.

    It's much more useful to handle the payment over an API on server-side instead of risking a user being irritated by additional messages displayed by the browser where the user must actually decide whether or not the additional redirect is to be performed.

提交回复
热议问题