$this.printAsset = function () {
var selectedIds = selectedAssetIds();
if (selectedIds.length == 0) {
bootAlert("");
return false;
}
window.location.href = "/Asset/Print?ids=" + selectedAssetIds();
};
A snippet of code on the Internet that triggers this method after clicking a button, and then downloads an excel file.
what is less clear is that after triggering the method, the address displayed on the browser does not change to http://example.com/Asset/Print?ids=**
, and the network of Chrome does not listen for any network requests. At first, I thought excel was generated purely from the front end, but typing the address http://example.com/Asset/Print?ids=**
,excel directly into the browser"s address bar can still be downloaded.
is very awkward, a very simple question, but I didn"t come up with it at once. It should be that after sending the request http://example.com/Asset/Print?ids=**
, the background will return a file after processing. It is equivalent to a download function in disguise.