Does any one know to read a text file using XMLHttpRequest. I need to use it to read a .txt file for the inventory of my website.
Asked
Active
Viewed 1,832 times
0
-
1By any chance were you referring to this -> http://stackoverflow.com/questions/9155960/xmlhttprequest-to-read-an-external-file – mane May 21 '15 at 03:29
1 Answers
1
I don't know the extension of file you get from your website. As usual the extension is JSON and you need to parse it to text by
JSON.parse(xmlhttp.responseText);
If it's not you can use simple codes
<script>
var xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET", url, true);
</script>

ThanhND25
- 86
- 4