xml opening in div does not receive xsl

0

I have the HTML files, ajax.js and intrucao.js as follows.

When you click on agar.xml , the style sheet agar.xsl is not loaded.

The addendum is that the load is done in div . What's in the code that should be changed?

I have HTML as follows:

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Carregando Página em DIV / AJAX</title>
<script language="javascript" src="ajax.js"></script>
<script language="javascript" src="instrucao.js"></script>
</head>
<body>
    <div id="menu"><a href="#" onclick="abrirPag('agar.xml');">xml</a></div>
        <br><br>
    <div id="conteudo_mostrar"></div>
</body>

The file ajax.js :

function GetXMLHttp() {
    if(navigator.appName == "Microsoft Internet Explorer") {
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    else {
        xmlHttp = new XMLHttpRequest();
    }
    return xmlHttp;
}

var xmlRequest = GetXMLHttp();

The file instrucao.js :

function abrirPag(valor){
    var url = valor;

    xmlRequest.open("GET",url,true);    
    xmlRequest.onreadystatechange = mudancaEstado;
    xmlRequest.send(null);

        if (xmlRequest.readyState == 1) {
            document.getElementById("conteudo_mostrar").innerHTML = "<img src='loader.gif'>";
        }

    return url;
}

function mudancaEstado(){
    if (xmlRequest.readyState == 4){
        document.getElementById("conteudo_mostrar").innerHTML = xmlRequest.responseText;
    }
}
    
asked by anonymous 05.09.2018 / 21:23

0 answers