/    Sign up×
Community /Pin to ProfileBookmark

Read OK — Write ability?

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?

to post a comment
JavaScript

9 Comments(s)

Copy linkTweet thisAlerts:
@tirnaMar 18.2010 — 
Is it possible to use javascript and AJAX together
[/QUOTE]


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.
Copy linkTweet thisAlerts:
@JMRKERauthorMar 18.2010 — Your answer would be fine if I had access to PHP on my server.

I do not, so the bottom line is no.

Thanks for the communication.

?
Copy linkTweet thisAlerts:
@svidgenMar 18.2010 — You have [I]no[/I] server-side scripting available?
Copy linkTweet thisAlerts:
@JMRKERauthorMar 18.2010 — You have [I]no[/I] server-side scripting available?[/QUOTE]

True. Educational site (restrictive access). :o

I can write text and JS and HTML files on server, but .php file extensions are not executed. ?

If you know of a workaround, please PM me. ?
Copy linkTweet thisAlerts:
@svidgenMar 18.2010 — No cgi-bin? Have you spoken with a sysadmin?
Copy linkTweet thisAlerts:
@JMRKERauthorMar 18.2010 — Comments in [COLOR="Red"]red[/COLOR]
No cgi-bin?


[COLOR="Red"]Yes, have cgi-bin, but no user changes allowed by sysadmin[/COLOR]

Have you spoken with a sysadmin?

[COLOR="Red"]Yes, they don't trust anyone messing with their cgi area at this university (paranoid?)[/COLOR]
[/QUOTE]


Bummer dude! :eek:

Thanks for the thoughts though. ?
Copy linkTweet thisAlerts:
@svidgenMar 18.2010 — 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?
[CODE]#!/usr/bin/perl
print "<html><body>wull hullo!</body></html>";[/CODE]
Copy linkTweet thisAlerts:
@JMRKERauthorMar 18.2010 — Maybe it my terminology your having trouble with. :o

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) ?
Copy linkTweet thisAlerts:
@svidgenMar 18.2010 — I can read/write/execute (perl, html, JS) on my personal space.[/QUOTE]
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 [I]Hello World[/I] (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.)
×

Success!

Help @JMRKER spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.29,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...