Redirect from POST to application / csv without form

I have a link / button on my page that should lead the user to the csv file. A csv file is generated dynamically using PHP based on some POST variables:

<?php
    header("Content-type: application/csv");
    header("Content-Disposition: attachment; filename=e".date('ymdHis').".csv");
    ...
?>

How can I redirect to a script while passing POST variables without using a form?

Answers I found that I do not really like this:

  • Create a hidden POST form with the required variables and call the message using javascript
  • Use jQuery.post to load the page - I still don't see how I can use jQuery or AJAX at all to redirect the page
+3
source share
1 answer

GET - GET ( URL), . POST ( , ), - (, ).

+2

Source: https://habr.com/ru/post/1785442/


All Articles