Is it possible to show a download dialog after sending POST data to the server?
Since I need many complex values "just" using a HTML form with method post won't work.
Until now I used the GET method the following way:
$("form").submit(function() {
window.location.href = 'upload.php?url='+$(".url").val()+'&host='+$(".host.clicked").attr("host");
return false;
}
which, with location.href will prompt me a nice download dialog, since upload.php returns headers for a file.
The problem now is that I want to give the user the option to upload a file to the form, which would not work with the GET url method I'm using.
So how can I show the download dialog after eg sending the data with AJAX and POST to the server?
You cannot use AJAX to download a file.
Instead, you should let the form submit normally.
upload.php can be the action of a POST form.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.