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 PostThe easiest way is just using a standard URL call
In AS3 it can be done withvar url:String = "javascript: your_js_function();"; var request:URLRequest = new URLRequest(url); navigateToURL(request, '_blank');
It's different for AS2 but if you Google it I'm sure you can find it
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 …
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.