473,394 Members | 1,865 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Include ASP using Javascript

I have an ASP script called blah.asp. I wanted to include it in
another ASP file on another server, without using <!--#include etc.

I had seen another script that looked similar to:
<script language="javascript"
src="http://www.mydomain.com/blah.asp"><script>

But when I tried it nothing showed up on the main ASP page. If I run
"http://www.mydomain.com/blah.asp" file on its own it runs fine. Can
anyone point me in the right direction?

TIA
Jul 23 '05 #1
3 7101
On 27 Dec 2004 22:06:41 -0800, Fianna Sidhe wrote:
I have an ASP script called blah.asp. I wanted to include it in
another ASP file on another server, without using <!--#include etc.
Why? (I assume that is the way an include is done in ASP)
I had seen another script that looked similar to:
<script language="javascript"
src="http://www.mydomain.com/blah.asp"><script> [1]

To be blunt Fianna, what you are attempting seems both pointless
and silly.

Silly, because you are replacing a server-side feature that you
have acess to, in lieu of a client-side technology that may or may
not be enabled (or even present).

Pointless, because it will not work. You need to include the
material at the server, whereas JS runs on the client.
Note that their *are* ways to have further text appear in pages
that is written by a JS script, but thay are *almost* *always*
bad scripts for the very fact that non-JS browsers will not
render the content.
But when I tried it nothing showed up on the main ASP page.


[1] As an aside, that snippet above appears to be that the '.asp'
file is generating the JS, so that page is actually referencing
a file that contains JS (and only JS).

Use ASP for your include. Any which way you cut it, it makes
a great deal more sense.

--
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.LensEscapes.com/ Images that escape the mundane
Jul 23 '05 #2
I love being called silly and pointless. It really makes my day. I know
diddly about javascript so that is why I posted looking for help.

I suppose I could have explained myself better. What I wanted was to
use JS to include results from an ASP page in an non-ASP page. So a
person with a plain HTML page could use a snippet of JS on their HTML
page and access results from my database.

Your aside is what got me pointed in the right direction.
<snip>

[1] As an aside, that snippet above appears to be that the '.asp'
file is generating the JS, so that page is actually referencing
a file that contains JS (and only JS).
</snip>

Here is my solution.

1) On the display page display.html I inserted the following line:

<script language="javascript"
src="http://www.mydomain.com/blah.asp"></script>

2) Inside the blah.asp page:

<%
Dim con, rs, strCon

Set con = Server.CreateObject("ADODB.Connection")
Set rs = Server.CreateObject("ADODB.Recordset")
strCon = mYcONNECTIONsTRING
con.Open strCon

StrSQL = "SELECT blah from tblBlah Where Blah=Blah"
rs.Open strSQL, con

%>

document.write("End Result: <%=rs("Blah")%>");
In the end, all I needed was to output my asp result in JS compliant
format using document.write

Jul 23 '05 #3
In article <da**************************@posting.google.com >,
fi**********@hotmail.com says...
I have an ASP script called blah.asp. I wanted to include it in
another ASP file on another server, without using <!--#include etc.

I had seen another script that looked similar to:
<script language="javascript"
src="http://www.mydomain.com/blah.asp"><script>

But when I tried it nothing showed up on the main ASP page. If I run
"http://www.mydomain.com/blah.asp" file on its own it runs fine. Can
anyone point me in the right direction?


Won't blah.asp need to output JavaScript content? After all, what's the
JavaScript interpreter in the browser going to do with whatever blah.asp
throws in to it?
--
Hywel http://kibo.org.uk/
I do not eat quiche.
Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: Peter Bassett | last post by:
I have a .shtml file, that displays photos, in which I wish to pass some functionality off to an Include file for reusability purposes. Unfortunately, it's not working. Here is a portion of the...
22
by: Weston C | last post by:
I know of course that you can use <script src=""></script> in an HTML document to include javascript code you don't want to spill all over the page. I'm wondering if there's a way to include...
4
by: Jeremy | last post by:
I have an include file which has some text such as: The quick brown fox jumped over the lazy dog I want to have a certain amount of that text to display on one page wherein the user can click...
5
by: Tony Strazzeri | last post by:
Hi all, I a fairly new to html and Javascripting. I have been trying to write some code to hide my email address from spam harvesters. I copied the code from various web examples and modified...
3
by: Brit | last post by:
Hello, I have been trying to include a js file from within another js file. I can get this to work for firefox, but not i.e. What I have is a.html ... <script language='JavaScript'...
14
by: Julesh | last post by:
Hello, I am new to ASP and am trying to make some changes to some ASP 3.0 code I have inherited. I have a number of ASP pages with VBS as the base language, on each of these pages I have...
1
by: Carafound | last post by:
Help!!! I am trying to write an ASP include statement <!--#include file="file.asp"--to an HTML stream in a new window using Javascript document.write command. The page gets built however the...
2
by: =?Utf-8?B?UGFi?= | last post by:
I am developing the web controls and try to include all client files: scripts, styles, etc in an assembly as resource common way like: , and use ClientScriptManager class. I have faced a problem...
4
by: rocketeer | last post by:
I've a set of Javascript classes that maintain state. For example, gm.js might be: var GroupManager { groups: {} }; Over time I add new groups to the list: GroupManager.groups = myGroup; ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.