我想通过ajax制作ZIP文件并下载。在 PHP(makezip.php) 中动态生成 ZIP 文件。http://exmaple.com/myzip.zip我如何通过javascript下载???in javascriptfunction download(){ $.ajax({ url: http://example.com/makezip.php // to Ajax type: 'POST', dataType: 'json', data: {'id' : id} }).then( function(data) {//How should I do here for download???// var blob = new Blob([ "http://exmaple.com/myzip.zip" ], { "type" : "zip" });// let link = document.createElement('a');// link.href = window.URL.createObjectURL(blob);// link.download = 'myzipname.zip'; // link.click(); } );};
- 1 回答
- 0 关注
- 155 浏览
添加回答
举报
0/150
提交
取消