Can window.location.href realize the function of type ajax?

 $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.
Mar.02,2021
It is not clear whether

can implement ajax, but this window.location.href ='/ Asset/Print?ids=' + selectedAssetIds () is equivalent to opening a file, and the browser will download the file when it is opened.


this is equivalent to opening an excel, and downloading it automatically. But you can't get the data like ajax


this is implemented by the backend, so the code window.location.href ='/ Asset/Print?ids=' + selectedAssetIds (); sends a get request to the backend, and the backend returns a stream of Excel files


bootAlert('');
        return false;

the return false here causes the following code not to execute

Menu