Jump to content

Reading a text file in JavaScript


johncraw

Recommended Posts

I have created a JavaScript file that creates table rows and columns. The intention is to use this in children's games. The code is very generic and the same code is used for different games. The problem is that for each game, I have to create a new .js file and supply the specific data for that game.Is there a way, in JavaScript, to open and read a text file so I just need to change this rather than the code. So far I have found nothing.Any help or direction would be appreciated. Thanks John Crawford

Link to comment
Share on other sites

Thanks. However...I know nothing about Ajax. I will look to see if I can figure out how to do it.The files that I want to read are on the local hard drive, not on a server. I don't know if that makes a difference.I was hoping for a Java solution. John

Link to comment
Share on other sites

Ajax requests can only read files on the same server as the domain where the request originated. A Java applet would be one option to read local files. Javascript does not have access to the local filesystem.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...