|
|
Q498 Do you know of anyway to retrieve data from a .txt file located on the server?
irt.org | Knowledge Base | JavaScript | File | Q498 [ previous next ] Q498 Do you know of anyway to retrieve data from a .txt file located on the server?No, Client Side JavaScript cannot read text files. One solution is to hold the data in a hidden form field and then read the contents for the form field:
The following was submitted by Kevin Hatfield Use the 'ondownload' behavior in DHTML. It works with jscript to download any text file into a variable, as long as the file is on the same domain. (Or you could use the File System Object by calling vbscript from jscript) This example is from the MSDN library. The variable "s" contains the contents of the file "download.htm" (It doesn't have to be done in-line. You can assign the behavior using script as well)
|
-- div -->
|