First, I know <input type="file" value="c:\\blah.txt">
won't work. I have tried Ajax, and other things, but Google has security, so I can't. How could I possibly load a local file in JavaScript (Not PHP)? No, i'm not trying to steal people's data.
Or, if none of this will work, is it possible to pass data from a command prompt to a HTML/JavaScript file/page without a complicated server setup? (The command prompt reads the file, and gives it to the HTML).
What I am not trying to do:
<script type="text/javascript" src="//www.mydomain.com/scriptfile.js">
One of my failed tries:
$.ajax({
type: "GET",
url: path,
dataType: "script",
});
I have tried to use the script and text type for both JS and text files, but no luck. I keep getting Google security errors in the console.
What I am trying to do:
I want to load a file.txt in the "File" format. Lets say I have var x = /path/to/localfile/text.txt
.
Then, I want to do basically:
var x = "c:\\folder\\test.txt";
$.ajax({
async: false,
type: "GET",
url: x, //<------
dataType: "text",
contentType: "application/x-www-form-urlencoded;charset=UTF-8",
success: function (data) {
alert(data);
//parse the file content here
}
});
Basically, I want to load a file from a variable name, and send the data of the text file to variable y.
But how ever many methods I try, they don't work.