Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Aug 2002
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question executing CGI from Javascript function

    Is there a way for javascript to retrieve a string a CGI script returns/prints?
    My script is on http://www.dubfilter.com/cgi-bin/album/dirlist.cgi
    the execution command is http://www.dubfilter.com/cgi-bin/album/dirlist.cgi?filedir=../../album/display and my html file with the javascript in the header is at http://album.dubfilter.com/new/index.shtml (made it shtml in case the only way to do this is using the SSI #exec command).
    any help will be appreciated. i have searched forums and internet reference guides, with absolutely no luck. i hope there is a way to do this.
    thanks in advance.

  • #2
    Senior Coder joh6nn's Avatar
    Join Date
    Jun 2002
    Location
    72 W. 48' 57" , 41 N. 32' 04"
    Posts
    1,887
    Thanks
    0
    Thanked 1 Time in 1 Post
    i know a little about this, but i've no experience with server side, so i might not get it exactly right.

    you can make a server side script run by calling it as an external javascript file.

    <script language="javascript" src="http://www.dubfilter.com/cgi-bin/album/dirlist.cgi?filedir=../../album/display"></script>

    in order to get javascript to be able to use the results, you just have to make sure that the results that are returned are in the form of javascript. i think the mimetype for javascript is text/javascript, but i'm not positive of that.

    hope that helps.
    bluemood | devedge | devmo | MS Dev Library | WebMonkey | the Guide

    i am a loser geek, crazy with an evil streak,
    yes i do believe there is a violent thing inside of me.

  • #3
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It sounds to me like what you want is for javascript to read the query string, which you can retrieve using location.search

    Have a look at this thread Parse search string into get variables for a more sophisticated function to retrieve the name/value pairs


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •