Include ASP using Javascript

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Fianna Sidhe

    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="javas cript"
    src="http://www.mydomain.co m/blah.asp"><scri pt>

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

    TIA
  • Andrew Thompson

    #2
    Re: Include ASP using Javascript

    On 27 Dec 2004 22:06:41 -0800, Fianna Sidhe wrote:
    [color=blue]
    > I have an ASP script called blah.asp. I wanted to include it in
    > another ASP file on another server, without using <!--#include etc.[/color]

    Why? (I assume that is the way an include is done in ASP)
    [color=blue]
    > I had seen another script that looked similar to:
    > <script language="javas cript"
    > src="http://www.mydomain.co m/blah.asp"><scri pt>[/color]
    [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.
    [color=blue]
    > But when I tried it nothing showed up on the main ASP page.[/color]

    [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

    Comment

    • fianna_sidhe@hotmail.com

      #3
      Re: Include ASP using Javascript

      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="javas cript"
      src="http://www.mydomain.co m/blah.asp"></script>

      2) Inside the blah.asp page:

      <%
      Dim con, rs, strCon

      Set con = Server.CreateOb ject("ADODB.Con nection")
      Set rs = Server.CreateOb ject("ADODB.Rec ordset")
      strCon = mYcONNECTIONsTR ING
      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

      Comment

      • Hywel Jenkins

        #4
        Re: Include ASP using Javascript

        In article <dab9ce46.04122 72206.25402e64@ posting.google. com>,
        fianna_sidhe@ho tmail.com says...[color=blue]
        > 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="javas cript"
        > src="http://www.mydomain.co m/blah.asp"><scri pt>
        >
        > But when I tried it nothing showed up on the main ASP page. If I run
        > "http://www.mydomain.co m/blah.asp" file on its own it runs fine. Can
        > anyone point me in the right direction?[/color]

        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.

        Comment

        Working...