Hi!
I have now learned how to write to and read from .txt files on my server via php, but is it possible to do this with JavaScript?
:icon_question:
Like that JavaScript writes to the .txt file every second without needing the user to refresh the page to write or read .txt file (with php).
2:
Do the same thing with ActionScript 2/3.
ErlendHL 0 Junior Poster in Training
Recommended Answers
Jump to PostJavascript itself cannot write on the server however AJAX would be a good way to do this, the AJAX tutorials at Tizag.com, they are very good.
As for doing it through AS, …
Jump to PostYou can use JavaScript to load a txt file via the XmlHttpRequest object (AJAX). You can code this yourself, or use framework like jQuery, which makes the process easily, basically use 1 line of code.
For writing, since the txt file is on the server, you need a backend …
Jump to PostThe way it would work would be JavaScript creates an XmlHttpRequest object which fires off GET/POST method to a PHP page that has your PHP function. You could also pass variables from JavaScript to your PHP page. I have a meeting right now, so I'll write you some sample code …
Jump to PostFrom a quick eyeballing...
In index.html:
Lines 12-19 and 27-34 are repetitive. I would remove them from both functions and put that block of code once above line 9, since you're declaring them global anyways.
Line 26 needs a semicolon.
Line 35, you meant XML not …
All 13 Replies
samarudge 16 Posting Whiz
ErlendHL 0 Junior Poster in Training
samarudge 16 Posting Whiz
samaru 145 a.k.a inscissor Team Colleague
ErlendHL 0 Junior Poster in Training
ErlendHL 0 Junior Poster in Training
samaru 145 a.k.a inscissor Team Colleague
ErlendHL 0 Junior Poster in Training
samaru 145 a.k.a inscissor Team Colleague
ErlendHL 0 Junior Poster in Training
samaru 145 a.k.a inscissor Team Colleague
fxm 23 Posting Pro
Donald_2 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.