I am fully aware that there are many debates(and solutions) out there in terms of downloading files in javascript/jQuery, such as iFrame, jQueryPlugin.
iFrame
jQueryPlugin
You might want to try FileSaver.js which has support for all modern browsers.
var blob = new Blob(["Hello, world!"], {type: "text/plain;charset=utf-8"}); saveAs(blob, "hello world.txt");