cgi script not invoked by javascript

I'm revising an online reservation system, which formerly  had the following javascript:

<script language="Javascript" type="text/Javascript">if(!parent.frames['MainFrame']){parent.location.href='/cgi-bin/rsv50load.pl?0001/ab0001.html';}</script>

In the new system, there are no frames, and the name of the page to load is different. However, the following code doesn't invoke the cgi script:
 
<script language="javascript" type="text/javascript">window.location.href='/cgi-bin/rsv50load.pl?rezeasy-ab.html';}</script>

Please advise.
ddantesAsked:
Who is Participating?
 
Dave BaldwinConnect With a Mentor Fixer of ProblemsCommented:
First, the '}' at the end causes a syntax error and it won't execute because of that.  As soon as I removed that, it worked.  Remove that and see what's next.
0
 
Randy DownsOWNERCommented:
Are you seeing errors or just a blank page?
0
 
ddantesAuthor Commented:
Thank you for your comment.  Not seeing an error.  The page -- booking_data.html -- loads, which says "please wait..." and nothing further happens.  The cgi script is supposed to transfer the visitor to our secure server and load a form.   If I try this with WampServer,  the Apache access log should have shown something like:

"POST /cgi-bin/rsv50std.cgi HTTP/1.1" 200 1691

but it doesn't show that.
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
ddantesAuthor Commented:
That made a difference.  I get an error 404 now.  On WampServer, there is no cgi error, and the access log shows:
GET /cgi-bin/rsv50load.pl?rezeasy-ab.html
0
 
Randy DownsOWNERCommented:
404 means the page doesn't exist
0
 
ddantesAuthor Commented:
I think, due to Dave's comment @ 1055, the initial syntax problem is fixed.  The 404 error has also been resolved by correcting a path error in a pl file.

Now there is a message:
Cannot open file: /srv/m/maui2/mtw/RezEasy/loadrsv.txt.
I think I should open another question relating to the loadsrv.txt issue.
However, the Apache access log still doesn't show POST /cgi-bin/rsv50std.cgi, and I would like to settle that.
0
 
Randy DownsConnect With a Mentor OWNERCommented:
You might get a better idea of what's happening with jsfiddle

http://www.youtube.com/watch?v=uFIyPWMfl-0

http://stackoverflow.com/questions/5655058/inspecting-javascript-on-jsfiddle-net-in-google-chrome

In the Developer Tools, under the Script tab if you select fiddle.jshell.net from the dropdown, around line 20-30 (depending on how much CSS you have) you will see a <script> tag that contains the code from the Javascript fiddle window. You can set your breakpoints here.
0
 
Dave BaldwinFixer of ProblemsCommented:
Loading a page thru "window.location.href" will Never show POST, always GET.
GET /cgi-bin/rsv50load.pl?rezeasy-ab.html  is the correct entry.  Only a <form> with 'post' or an AJAX using 'post' will ever show POST in the logs.

Is "/srv/m/maui2/mtw/RezEasy/loadrsv.txt" under the web root?  If not, then your CGI program may not have permission to access it.
0
 
ddantesAuthor Commented:
Thank you.  Yes, the loadrsv.txt file is under the web root.

Regarding window.location never showing POST,  is that also true for parent.location?  Because, with the previous javascript -- and that function -- POST was in the logs.
0
 
Dave BaldwinFixer of ProblemsCommented:
I'll say it again... Only a <form> with 'post' or an AJAX using 'post' can do an HTTP POST.  You can also create an HTTP POST with Perl and it's possible that that was what you saw.  But all links to another page with <a href""... or window.location are GET's.  You can not make them be POST's.

So it is really "C:/wamp/www/srv/m/maui2/mtw/RezEasy/loadrsv.txt"?
0
 
ddantesAuthor Commented:
OK, the POST must have been accomplished through rsv50load.pl.

The local web root is V:\Program Files\Web Publish\Maui Site 1\RezEasy\loadrsv.txt.
(I'm aware of your admonition about empty spaces in these paths).

On the remote server, the path is:
srv/m/maui2/mtw/RezEasy/loadrsv.txt

I'll wait for your reply before closing this question, but I think I should award points for correcting my "}" syntax error, which addressed this question.

The loadrsv.txt issue should probably be posted as a separate question.  This program I'm trying to adapt is difficult for me to comprehend.  Pages are loaded by rsv50load.pl, which refers to rsv50conf.pl to determine base URL and pathways, and the cgi script is rsv50std.cgi.
0
 
Dave BaldwinFixer of ProblemsCommented:
If 'V:\' is a mapped drive and 'loadrsv.txt' is actually on that remote drive, then you probably don't have permission to use it, particularly to write to it.  The 'rsv50...' programs will load but they will execute locally and may not have permission to access the remote drive.  They will still be running under the Apache user which doesn't want you to access non-local drives even if they are 'mapped'.

In general, web servers are 'sandboxed' to prevent you from doing things like accessing files on remote systems that are not available thru a web server.  Running it on a mapped drive is an attempt to straddle the line that doesn't always work.
0
 
ddantesAuthor Commented:
Very well.  I copied my web files to the C:\ root directory, and changed httpd.conf references from V:\Program Files (etc.) to C:\Maui Site 1 (etc.).   I still get:
Cannot open file: /srv/m/maui2/mtw/RezEasy/loadrsv.txt
0
 
Dave BaldwinFixer of ProblemsCommented:
For what it's worth, here's the directory structure of my WAMP installation on C:.  Everything that is web accessible is in the 'www' directory or it's subdirectories.

WAMP directory structure
0
 
ddantesAuthor Commented:
I'm glad to have that example.  My file system was organized before I ever heard of WampServer.  Being a creature of habit, I've got some resistance to altering its structure to accommodate WampServer.  At the same time, I'd like that application to be effective.

I'll award points now, and may post a question focused on the loadrsv.txt issue.

Thanks to both experts!
0
 
Dave BaldwinFixer of ProblemsCommented:
Thanks for the points.  Maybe "/srv/m/maui2/mtw/RezEasy/loadrsv.txt" is hard-coded in one of the CGI files such that it doesn't look for it where it really is anymore.
0
 
ddantesAuthor Commented:
I think you're right.  I may post a new question, and if so, I'll attach the relevant files.  Thanks again.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.