Eine Zip-Datei als Antwort auf eine AJAX-Anfrage erhalten

So arbeite ich an einer Website, die einen Anruf beim Server tätigen muss und eine Zip-Datei zurückgibt, die Sache ist, dass ich nicht ganz sicher bin, ob ich alles richtig mache. Der Code sieht ungefähr so aus:

function download(){
  if($('.download').hasClass('activeBtn')){
    $.ajax({
        type: 'GET',
        url: someUrl,
        contentType: 'application/zip',
        dataType: 'text',
        headers: {
            'Api-Version': '3.4'
        }

    }).then(function (data) {
      console.log(data); //Basically prints the byte array
      //Here I should build the file and download it
    });
  }
}

Wie Sie sehen können, muss ich die Datei mit dem Byte-Array in der Antwort erstellen. Wie kann ich das tun?

Antworten auf die Frage(2)

Ihre Antwort auf die Frage