Advertisement
Guest User

Untitled

a guest
Aug 19th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. function readTextFile(file)
  2. {
  3. var rawFile = new XMLHttpRequest();
  4. rawFile.open("GET", file, false);
  5. rawFile.onreadystatechange = function ()
  6. {
  7. if(rawFile.readyState === 4)
  8. {
  9. if(rawFile.status === 200 || rawFile.status == 0)
  10. {
  11. var allText = rawFile.responseText;
  12. alert(allText);
  13. }
  14. }
  15. }
  16. rawFile.send(null);
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement