I have used AJAX to read a text file from the server. Very useful.
Is it possible to use javascript and AJAX together to write to a text file or modify an existing text file?
I know that it is not possible with JS alone.
If yes, are there any example code or tutorials available to review?
Is it possible to use javascript and AJAX together
Firstly, you're misinterpreting javascript and ajax to be two different things when they are not.
AJAX is just a particular way of using javascript.
AJAX = Asynchronous Javascript And XML
Anyway, to answer your question you can code the php script the ajax function calls to open, read, edit, save text files using the php file handling functions. They're all documented in the online php manual.
No cgi-bin?
Yes, have cgi-bin, but no user changes allowed by sysadmin
Have you spoken with a sysadmin?
Yes, they don't trust anyone messing with their cgi area at this university (paranoid?)
Weird that they would completely disabled cgi's ... Have you tried uploading a "standard" cgi script? ... You know, one of those archaic things that actually has to specify the executable needs to parse it?
I can execute existing cgi programs
I can read/write/execute (perl, html, JS) on my personal space.
When I try to execute any <?php> tags in my space on the system, it just ignores my requests.
I cannot modify anything in the university's cgi directory space without their expressed approval.
Maybe my problem with sysadmin is the same I'm having with you.
I may know just enough to get myself into trouble but cannot express it the way it should be expressed!
I do appreciate your thoughts and will try again with the university's OIT. (Office of Information and Technology)
I can read/write/execute (perl, html, JS) on my personal space.
If I'm understanding you correctly, this is all you need to be able to do. As long as your system's copy of perl is located in the traditional /usr/bin/perl path, the Hello World (wull hullo) script I supplied should be a suitable test.
Drop it into the your web docs directory (preferably the cgi-bin folder, if it exists), chmod it to 755, and try to hit it in a web browser. If it displays "wull hullo" on the screen, you should be able to accomplish what you need. (Though I would advise against using perl scripts for AJAX -- or at all, if you can avoid it.)
Bookmarks