johncraw Posted March 5, 2012 Share Posted March 5, 2012 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 More sharing options...
justsomeguy Posted March 5, 2012 Share Posted March 5, 2012 You can send an ajax request to get the contents of any file on the same server. Link to comment Share on other sites More sharing options...
johncraw Posted March 5, 2012 Author Share Posted March 5, 2012 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 More sharing options...
justsomeguy Posted March 6, 2012 Share Posted March 6, 2012 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 More sharing options...
johncraw Posted March 6, 2012 Author Share Posted March 6, 2012 Thank you.However I did learn something Ajax = Asynchronous JavaScript and XML.Live and learn! John Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.