The download
var link = document.createElement("a");
link.download = name;
link.href = uri;
link.click();
is working without being in jQuerys' submit.
But here
$('form').submit(function(e) {
e.preventDefault();
var uri = $(this).find("input").attr("data-uri");
var name = $(this).find("input").attr("data-name");
alert(uri); // Does work!
// This download does not work ...
var link = document.createElement("a");
link.download = name;
link.href = uri;
link.click();
// Download end
$.ajax({
url: 'entry.php',
type: 'POST',
data: $(this).serialize()
});
});
it does not work. The uri and the name are correct.
Is it possible to create elements after submitting?
What can be done to make the download work?