Include ASP using Javascript

F

Fianna Sidhe

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
 
F

fianna_sidhe

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top