read file content js code example
Example 1: read file javascript
// As with JSON, use the Fetch API & ES6
fetch('something.txt')
.then(response => response.text())
.then(data => {
// Do something with your data
console.log(data);
});
Example 2: javascript load content from file
//with JQuery
jQuery.get('http://localhost/foo.txt', function(data) {
alert(data);
});