Eae, people.
I want to tell you first that I do not handle a lot of java and these types of code, so I already hope I do not have answers, but come on.
Next, what I need to do, for a project, is to use the text that is inside a ".txt" file and place it as text in an HTML page.
I've been searching, and from what I understand, you can not do this because the file is local (file: ///) and is not hosted on a server.
Is there any way around this? This project will not be uploaded. It will not go online, the only person who will open it is me, on my PC.
But then, if that's not possible, I need help with the code to make it work online.
HTML:
<div id="printed"></div>
CSS:
var text_print = new XMLHttpRequest();
text_print.open("GET", "http://www.textfiles.com/etext/FICTION/2000010.txt", true);
text_print.onload = function (){
console.log( text_print.responseText.slice(0, text_print.responseText.indexOf("\n")) ); };
text_print.send();
document.getElementById("printed").innerHTML=text_print;
I do not even need to say it did not work, right? hahaha
As I said, no java and spade jargon, so I've found something similar on the internet and I ended up with that code, but it does not work.
I think there's no need to explain, but what I need is for the text in the file "2000010.txt" to become the div with "printed" id.
Thank you.