Possible Duplicate:
Return automatic download JQuery Ajax Call
I am creating a file zip-fly with PHP. The file is created without problems. Even I have it set to not be saved on the server but immediately begin downloading.
In that file I call using jquery from another file by pressing a button. The code is as follows.
$(".down").on("click",function(){
id = this.id;
$.ajax({
type: "POST",
url: "files/down.php",
data: "id="+id,
cache: false,
success: function(data){
//alert(data)
}
});
});
I want that when you click on the button I display the browser download window and I do not do it ... and do not know how ...
Everything works correctly because if I tell PHP to save the file on the server does. If you tell me the answer in an alert()
makes me full of strange symbols so something is returning, but not how to make it back to me with the download window.
Does anyone know how to do?