In an HTML form could I type something and see if it matches against something in a text file? If so, how would I go about doing this?
Asked
Active
Viewed 49 times
0
-
1Maybe this would help http://stackoverflow.com/questions/14446447/javascript-read-local-text-file – David Feb 26 '17 at 21:39
-
1You should be more specific. The question is unclear. – Nemus Feb 26 '17 at 21:39
2 Answers
1
You could use an ajax request to load a JSON file from your server
eg if you are using jQuery
$.getJSON( "my-json-file.json", function( data ) {
console.log(data.property);
console.log(data.anotherProperty);
});
this would assume you have a JSON file in your server root folder called my-json-file.json
with this structure
{
"property": "the data you want to store"
"anotherProperty": 999999
}
Be aware that you would have to wait for this JSON file to be loaded first before you could access and use the data in it. Eg the function with the 2 console logs in it will only be called once the JSON file is loaded

Matthew
- 952
- 7
- 20