Force Download Of .mp3 Or .zip Files On Ajax Success
After a user fills out an email verification form (which is submitted via AJAX), I want to force a download to start in the current browser window if the AJAX call response is succ
Solution 1:
create an iframe for each url to download and set the iframe's source to files url :)
var
urls = ['url_1.mp3', 'url_2.mp3', /* ... , */ 'url_N.mp3'],
doLoad = function(url){
$("<iframe />")
.css("display", "none")
.bind("load", function(e){
this.src == url && $(this).remove();
})
.attr("src", url)
.appendTo($(document.body));
};
for( var i=0; i < urls.length; i++ ) {
doLoad( urls[i] );
}
Post a Comment for "Force Download Of .mp3 Or .zip Files On Ajax Success"