Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

319
Visualizações
How can i receive all text content after download xml file with createObjectURL(blob)?
<a download="hello.xml" href='#' id="link">Загрузить</a>
<script>
var text = "<OPTP5101>Them-on-us Sale POS</OPTP5101><OPTP5102>Them-on-us Refund POS </OPTP5102>";
let blob = new Blob([text], {type: 'text/plain'});
link.href = URL.createObjectURL(blob);
</script>

after download the file and open I've got just following

Them-on-us Sale POS

I need all text in xml file after downloading like that.

<OPTP5101>Them-on-us Sale POS</OPTP5101>
<OPTP5102>Them-on-us Refund POS </OPTP5102>

Is anybody know help me please!

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I found the solution when I added at the beginning and at the end of the text like this all displays when open with a browser

begining var text="<xml_cfg><global_params><param><name>OPTP</name><value>";
end text = text + "</value></param></global_params></xml_cfg>"

And the complete code looks like following

<a download="hello.xml" href="#" id="link">download xml</a>

<script language="JavaScript">
    var text="<xml_cfg><global_params><param><name>OPTP</name><value>";
    $.ajax({

        url: "rep.svxp_xml_download.download_xml_for_svxp",
        type: "POST",
        dataType: "json",
        data:{},
        error: function(XMLHttpRequest, textStatus, errorThrown) {
        toastr.error("Произошла ошибка "+textStatus,"Информация", {"closeButton": true});
        return;
        },
        success: function(data){

        for(let i=0; i<data.length; i++){

           text = text + "<" + data[i].optp + ">" + data[i].description + "</" + data[i].optp + ">";

        }
        text = text + "</value></param></global_params></xml_cfg>"

        let blob = new Blob([text], {type: "text/plain"});

        link.href = URL.createObjectURL(blob);
    }
 });

</script
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda