FileReader, return the response from reader.onloadend

0

I need help, I have this code to get the UUIDS of the xml loaded in my form, first I have $ .each to go through the input type = file and for each input get the uuid and put it into the uuids array, what I need is that when I finish the input path get what the array has uuids = [] but I do not know how to return that answer that is in reader.onloadend = function (event) if someone knows how to please help me

var arrayInputXML=$('input[name="fileXML[]"]');
                            $.each(arrayInputXML,function(id,vall){
                                var file = vall.files[0],
                                    reader = new FileReader();
                                reader.onloadend = function(event) {
                                    var uuids = [];
                                    var text = event.target.result;
                                    var parser = new DOMParser(),
                                    xmlDom = parser.parseFromString(text, "text/xml");
                                    uuid = xmlDom.children[0].lastElementChild.children[0].attributes[3].nodeValue;
                                    uuids.push(uuid);
                                }
                                reader.readAsText(file);
                            })
    
asked by Alejandro.C 03.07.2018 в 18:13
source

0 answers