Having troubles opening relative URL in Javascript xmlhttp object

Thursday, July 10, 2014

I've inherited an HTML/PHP/Javascript application that is not broken up in specific directories; meaning, everything was in one directory.


I want to clean up and modularize the directory structure, so, I moved everything.

(*.inc files moved to the "Includes" folder, *.css files moved to the "CSS" folder, etc.)

Naturally, there is some changes to the code to be made.


I was making a (Working) AJAX request like this:



xmlhttp.open("GET","oWin.php?name="+escape(name)+"&type="+ct,true);


where "oWin.php" resided in the same directory as the calling page. oWin.php is now located two directories up in the "Lib" folder. So, I needed to change it to this:



xmlhttp.open("GET","../../Lib/oWin.php?name="+escape(name)+"&type="+ct,true);


but, sadly, this does not work; I get a "Syntax Error" logged to the web console in FireFox.


Can someone shed some light on this as to why it is a syntax error?


FireFox version 30.0

Windows version 7, 64 bit

Apache 2.2.4, Win32

PHP 5.2.3


Thanks!


Keith







http://ift.tt/1qZPx6Z