[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details

How to share one include file between client and server scripts

Asked by moorabbit in Active Server Pages (ASP), Server Side Includes (SSI)

Tags: include files, asp, javascript, server-side includes, client-side includes

I'm using Javascript for both server and client code (ASP on the server). I have a group of shared javascript functions that are used by both my server code and my client code. Since these functions are called by several files, I maintain them separately rather than duplicating them in each calling file. In each calling file on the server side (ASP) I use a server-side include:
<!-- #include file="shared.inc" -->
In each calling file on the client side (HTM) I use src in the script tag:
<script language="JavaScript" src="shared.js"></script>
This works fine except that I have to maintain the shared functions in both files, shared.inc and shared.js, which are identical except that shared.inc starts with <% and ends with %> which is a nuisance. I would like to maintain these shared functions in only 1 file, but I don't see how to do that because an ASP include file needs the surrounding <% and %> but a file referenced by <script src=...> can't have them. Is there any way to have one file with the shared functions and reference it both in ASP and client-side Javascript?
[+][-]03/07/09 04:20 PM, ID: 23827318Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03/07/09 04:51 PM, ID: 23827401Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03/07/09 10:13 PM, ID: 23828172Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-89 - Hierarchy / EE_QW_FREE_TRIAL_20090127