View Full Version : File path/href dynamic discovery

12-07-2006, 11:11 AM
Can anyone advice how I can use javascript to output the location of the file it is currently executing on and output locations of other files aswell?

My attempt to use ajax to load up files from a folder called private is yielding no results. With this line of code:

request.open("GET", "/private/new_index_ajax.php?login="+userID, true);

The request object is fine, it just doesn't seem to like the directory path. The originating php file is in the same directory as the private directory so there shouldn't be any need to navigate away?

So, I want to find out where javascript "thinks" it is. Perhaps it's looking in the wrong place(s)?

I hope this make sence. Please help me.

12-07-2006, 03:21 PM
To answer your question...i am going to ask you a question.

Can you access the page you are calling via JS with your browser?


In other words, if you cannot access the page via your browser...then JS won't access it either.

Good luck.

12-07-2006, 04:32 PM
I see your point but the page I am trying to load via javascript does load by itself in IE and FireFox.