How to read xls in javascript

1

Hello, I am studying some "communication" between php and javascript, I am a beginner and I am a few days with a problem that I can not solve, in php I am generating an xls with DB data

function buscaLocalizacoes($conexao){
    $resultado = mysqli_query($conexao, "SELECT * FROM marcas");
    $manipulador_arq = fopen("C:\xampp\htdocs\04072016\marker.xml","w+");
    @fwrite($manipulador_arq,"<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n\n\n<mapa>");
    while($marca = mysqli_fetch_array($resultado)){
        $xml =       "\n\n<marker>\n";
        $xml .=             "<id>$marca[0]</id>\n";
        $xml .=         "<titulo>$marca[1]</titulo>\n";
        $xml .=         "<latitude>$marca[2]</latitude>\n";
        $xml .=         "<longitude>$marca[3]</longitude>\n";
        $xml .=     "</maker>";
        @fwrite($manipulador_arq,$xml); 
    }
    @fwrite($manipulador_arq,"\n\n</mapa>"); 

But I can not read this in javascript, I know it is possible through my searches but the file continues to load as null in the application, it follows the JS code

function loadXMLDoc() {
             req = false;
            if(window.XMLHttpRequest && !(window.ActiveXObject)) {
                try {
                    req = new XMLHttpRequest();
                } catch(e) {
                    req = false;
                }
                } else if(window.ActiveXObject) {
                    try {
                        req = new ActiveXObject("Msxml2.XMLHTTP");
                    } catch(e) {
                        try {
                            req = new ActiveXObject("Microsoft.XMLHTTP");
                        } catch(e) {
                            req = false;
                        }
                    }
                    }
                    if(req) {
                        var url = "file:///C:/xampp/htdocs/04072016/marker.xml";
                        req.open("GET", url , true);
                        return myFunction(req);
                    }
        }

The idea is for it to send the xml file to that "myFunction".

    
asked by anonymous 05.07.2016 / 20:20

0 answers