I would simulate click to download a file after called ajax to generate a link.
Jquery :
$(document).ready(function(){
$(".vignette-dl").click(function() {
var id = $(this).find("a").attr("value");
$.ajax({
type: "POST",
url: "testDL.php",
data: { dossier: $("#selectDossier").val(), id_doc: id },
success: function(result){
$("#secretDiv").html(result);
}
});
$(document).ajaxComplete(function(){
alert("test");
$("#forcedl")[0].click(function(){
alert("test42");
});
});
});
});
result var add an html link with id="forcedl" in secretDiv and work perfectly.
ajaxComplete function is called because i see my alert test, but the click simulate did not work and i didn't see the alert test42.
And i don't know why..