Hola a todos, tengo un problema con el Ajax estoy iniciándome. Quiero que Ajax cargue un archivo de texto (txt) al div (resultado) al cargar la pagina pero no funciona, lo estoy probando en Google Chrome y Mozilla Firefox pero ambos me dicen:
Uncaught Error: NetworkError: DOM Exception 19
XMLHttpRequest cannot load file:///C:/Users/Aridany/Desktop/Nueva%20carpeta/texto.txt. Cross origin requests are only supported for HTTP.
¿que le pasa al código, alguien me ayuda?.
<html>
<head>
<script language="JavaScript" type="text/javascript">
ajax = new XMLHttpRequest();
ajax.open('GET', 'texto.txt', false);
ajax.send(null);
document.getElementById('resultado').innerHTML = ajax.responseText;
</script>
</head>
<body>
<span id="resultado">Sin resultado</span>
</body>
</html>