I am trying to read the text file or an XML file but I am stuck.
How to pass the file name that I have to read. Once I get the contents of the file I am sure I will need to use regex but I am stuck on getting the file name and data inside it.
I am sure how to do this in jQuery, but I need to try this out using pure JavaScript and nothing else. Any pointers or suggestions would be of great help.
It is not possible to reliably read a filename using JavaScript only, due to security reasons. Even JQuery will fail at some point (Google Chrome tends to block Ajax calls to the local machine).
EDIT: An example of a JSON config object:
var config =
{
color: "blue",
time: "15:00",
amount: 1,
names: ["Bob", "John"]
}
var someName = config.names[1] //John
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.