Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

315
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!