Reputation: 974
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 e.g. sending the data with AJAX and POST to the server?
Upvotes: 1
Views: 603
Reputation: 746
upload.php can be the action of a POST form.
Upvotes: 0
Reputation: 888223
You cannot use AJAX to download a file.
Instead, you should let the form submit normally.
Upvotes: 1