开发者

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!


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"


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?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜