Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display a file residing on a different server?

Status
Not open for further replies.

Herring

Technical User
Mar 7, 2001
6
CA
I have an asp page on one server/domain, let's call it that generates a table from a database that also resides on that server.

I would like to display myTable.asp on another page on a different server which doesn't have asp support
I have tried including the following line where I want the table to be displayed in plain_file.htm
<script language=&quot;VBScript&quot; src=
It seems to go there but then I get error upon error popping up.
Line 3: Expected Statement
When I open up the debugger from IE, all the HTML code is correctly placed, the table is populated with the correct information.

I have removed HTML, HEAD,/HEAD, BODY, /BODY and /HTML tags from myTable.asp.

myTable.asp displays fine if viewed on it's own.
 
I should think that you either have a problem in your code somewhere. More than likly its a silly thing like a &quot;;&quot; missing or something spelt incorretly.

I hate suggesting using frames..but it might work. You could load the asp page into another frame in the window. Although frames are horrid i find and make the window look a mess when the browser is resized by the user.
 
Thanks for your reply Realgaz. I guess I didn't have email notification checked.
Following is the code from the 2 files involved. I've been messing around with it so long I think I've gone blind. I guess that's what happens when one only tries scripting every few months. :eek:
Any takers?

--------------------------------------------
This is --------------------------------------------
<html>
<head></head>
<body>
Regular HTML stuff in here.......

<SCRIPT LANGUAGE=&quot;JavaScript&quot; src=&quot;</body>
</html>

--------------------------------------------
And the following is the file stored on --------------------------------------------

<%@LANGUAGE=&quot;VBSCRIPT&quot;%>
<%
SET CONN1 = Server.CreateObject(&quot;ADODB.Connection&quot;)
Set RS = Server.CreateObject(&quot;ADODB.RecordSet&quot;)
AccessConnect = &quot;DSN=realestate;&quot;
SQLQuery = &quot;SELECT ListingNo, Category, Neighbourhood, Style, Area, Price FROM Listing where DateApproved <= Date()and (SaleTypeID = 3 or SaleTypeID = 1) and DateSold is null and (DateRemove is null or DateRemove >= date())order by Price&quot;
RS.Open SQLQuery, AccessConnect
%>
<%
Response.Write(&quot;<TABLE width='700' align='Center' border='0' cellspacing='0' cellpadding='3'>&quot;)
Response.Write(&quot;<TR><br>&quot;)
Response.Write(&quot;<TD colspan='2'><a href=' src='images/logo_s.gif' border='0'></a></TD><br>&quot;)
Response.Write(&quot;<TD colspan='4' align='center'><H2>Properties for sale and for rent.</H2></TD><br>&quot;)
Response.Write(&quot;</TR><br>&quot;)
Response.Write(&quot;<TR><br><TD colspan='6'>Properties for Sale</TD><br>&quot;)
Response.Write(&quot;</TR><br>&quot;)
Response.Write(&quot;<TR><br>&quot;)
Response.Write(&quot;<TD>Category</TD><br>&quot;)
Response.Write(&quot;<TD>Style</TD><br>&quot;)
Response.Write(&quot;<TD>Area</TD><br>&quot;)
Response.Write(&quot;<TD>Neighbourhood</TD><br>&quot;)
Response.Write(&quot;<TD>Price</TD><br>&quot;)
Response.Write(&quot;<TD>Details</TD><br>&quot;)
Response.Write(&quot;</TR>&quot;)
%>

<% if not RS.eof then
RS.MoveFirst
While NOT RS.eof
%>
<% if intRowColor = 0 Then
Response.Write(&quot;<TR bgcolor='green'>&quot;)
intRowColor = 1
Else
Response.Write(&quot;<TR bgcolor='red'>&quot;)
intRowColor = 0
End if
%>
<%
Response.Write(&quot;<TD width='150'>&quot; & RS(&quot;Category&quot;) & &quot;</TD><br>&quot;)
Response.Write(&quot;<TD width='150'>&quot; & RS(&quot;Style&quot;) & &quot;</TD><br>&quot;)
Response.Write(&quot;<TD width='150'>&quot; & RS(&quot;Area&quot;) & &quot;</TD><br>&quot;)
Response.Write(&quot;<TD width='125'>&quot; & RS(&quot;Neighbourhood&quot;) & &quot;</b></TD><br>&quot;)
Response.Write(&quot;<TD width='75'>&quot; & RS(&quot;Price&quot;) & &quot;</TD><br>&quot;)
Response.Write(&quot;<TD width='50'><a href=' & RS(&quot;ListingNo&quot;) & &quot;'>Details</a></TD><br>&quot;)
Response.Write(&quot;</TR>&quot;)
%>
<%
RS.MoveNext
Wend
End if
%>
<%
Set RS=Nothing
Set CONN1=nothing
%>
<%
Response.Write(&quot;</TABLE>&quot;)
%>
 
When you load a file with <script> tags, it's like putting <script> and </script> around the code on your page. Since none of the ASP page you're loading is actually Javascript, it's GOING to error.

Try, in the HTML file, putting:

<script>
<TABLE width='700' align='Center' border='0' cellspacing='0' cellpadding='3'>
<tr><td>Inside Script</td></tr>
</table>
</script>

and see what happens. It looks like what you want to load it as a Server Side Include (SSI), not as a script.
 
Trollacious - There are a couple of problems with this.
1 - The server/site the plain_file.htm resides on doesn't support SSI or ASP.
2 - The database is also on another site's server.

I'm obviously missing something here. Been staring at and messing around with this for too long.
 
What you're doing is exactly like putting HTML code inside script tags with no document.write() method. You can't do what you want the way you're trying to do it. If you want to load the file as a Javascript file, you have to write it as a Javascript file, no matter WHAT you name it.

The example I gave you:

<script>
<TABLE width='700' align='Center' border='0' cellspacing='0' cellpadding='3'>
<tr><td>Inside Script</td></tr>
</table>
</script>

shows what you're ACTUALLY doing by trying to load an ASP file inside <script>...</script> tags, and should be obvious why it won't work.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top