javascript read server file

Solutions on MaxInterview for javascript read server file by the best coders in the world

showing results for - "javascript read server file"
Charlotte
29 Oct 2019
1function loadFile(filePath) {
2  var result = null;
3  var xmlhttp = new XMLHttpRequest();
4  xmlhttp.open("GET", filePath, false);
5  xmlhttp.send();
6  if (xmlhttp.status==200) {
7    result = xmlhttp.responseText;
8  }
9  return result;
10}