check123
check123

Reputation: 2009

jQuery - Relative path to (ajax) load()

$("#popMenu-fk").load("secure/student.php");

The calling files rests in folder "a" while the php script is in "a/Secure" folder. However, I am not being able to access that file from that path, but if I paste the file in same folder as calling file and use

$("#popMenu-fk").load("student.php");

it works!

Am I going wrong somewhere? Thanks!

Upvotes: 1

Views: 9413

Answers (2)

Patrick
Patrick

Reputation: 7712

try:

$("#popMenu-fk").load("../a/secure/student.php");

That way no matter where you call this code from it knows where to go assuming that "/a" is right above the root and the code resides a single level above the root as well.

like if I have two folders...

<root>/js
<root>/ajax

and in the ajax folder I have a file caleld ajaxCalls.ashx

If i have a .js file in the js folder and I want to make ajax calls to the ajaxCalls.ashx file I would do something like

    url: "../ajax/ajaxCalls.ashx"

Upvotes: 5

Jarrett Widman
Jarrett Widman

Reputation: 6419

If you are on Linux then the file names are case sensitive and you have different casing in your sample, so maybe that is your problem?

Upvotes: 0

Related Questions