From: John Joyce Date: 2007-06-28T23:02:09+09:00 Subject: Re: Ajax with Ruby problem John Joyce On Jun 28, 2007, at 2:51 AM, Gale CC wrote: > Damn.. I really dont believe this!! > I gave a half-hearted try to what you said and it worked!! > I was previously working inside /cgi-bin/ajax-test directory and was > thinking it should not make a difference. What you said made no > sense to > me but I still gave it a try just to be sure. > Anyways, thanks so much!! > > Gale > > > > J-H Johansen wrote: >> On 6/28/07, Gale CC wrote: >>> I'm pretty sure the shebang line is correct. I verified by doing >>> "which >>> ruby" and also ran the file independently from the shell by typing >>> "./test2.rb" and it works. >>> >>> Also the file runs fine when its set as an "action" to a form, >>> but not >>> in this case when its run from inside a javascript script. Any idea >>> what's wrong ? >> >> Download the "web developer" plug-in for Firefox and enable while >> you're developing. It's a nice feature to see each and every call you >> make and you can even inspect the output from the calls. >> >> The reference you're using here looks a bit weird though. >> >> xmlHttp.open("GET","test2.rb",true); >> >> Normally, I would have to reference the cgi-bin directory as well, >> and >> this here appears to reference the Ruby script as though it was >> located in the same directory as the HTML file that produces the >> page. >> Try something like this: >> >> xmlHttp.open("GET","/cgi-bin/test2.rb",true); >> >> if the script is located at the root of the cgi-bin directory. > > > -- > Posted via http://www.ruby-forum.com/. > So the problem was not calling the script with the /cgi-bin directory in the path ? And the solution was pre-pending that to the path_to_script? Please post a clear solution, even if it is a link to a blog. this is a most interesting problem and solution that should probably be on the troubleshooting checklist for lots of people! thx