/    Sign up×
Community /Pin to ProfileBookmark

Can Javascript call a server side include?

Hi, I’m wondering if there is a way to pull a ssi at random the way you pull a random image like this:

<a href=”term_photos/spring_term_photos/prom/index.htm”><script type=”text/javascript” language=””>document.write(“<IMG border=1 HSPACE=2 BORDER=0 SRC=’random_images/” + Math.ceil(Math.random() * 15) + “.jpg’>”)</script>

For the above script, I would put images in the folder and name them “1.jpg, 2.jpg” etc. I would like to do the same thing with ssi’s, but I can’t get it to work. It seems like it should be easy. Is it?

Thanks.

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@monotobaDec 12.2003 — Hi,

I am new to JavaScript however, if JavaScript is anything like perl, vbs, and php, any file that is parsed on the server is not avaliable on the network over typical http protocol. If the file is simply a file that is not parsed but is simply included in another file that is parsed, then simply giving the url of the file should deliever it's contents.

I hope this helps.
Copy linkTweet thisAlerts:
@havikDec 12.2003 — http://forums.webdeveloper.com/showthread.php?s=&threadid=7014&highlight=document.write%2A

In this thread, it is stated that the INCLUDE (a server-side include) is a server-side function and the document.write is a client-side function. Once the file starts up at the client, it cannot use anything on the server. The SERVER has to read the INCLUDE, not the CLIENT.
×

Success!

Help @Jeffrask 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 5.15,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

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