开发者

jquery load function

开发者 https://www.devze.com 2023-01-16 22:46 出处:网络
i have this jQuery function: $(\"#text\").load(\"test3.php?id=\"+ Math.random()); And this code is in page:

i have this jQuery function:

$("#text").load("test3.php?id="+ Math.random());

And this code is in page: user.php

When i runt this page in this address: http://127.0.0.1/user.php - everthing is OK.

But, When i runt this page in this address: http://127.0.0.1/user/

开发者_如何学Python

in div "text" insert all root page.

test3.php page code:

<?php
echo "test 678";
?>


I'm not quite following the question, but there's a difference there and so this may help:

When the browser resolves a relative URL, it uses the document location. Your two document locations are different in that one of them looks like a path to which test3.php should be appended, the other looks like a page name that test3.php should replace:

http://127.0.0.1/user.php + test3.php = http://127.0.0.1/test3.php

but

http://127.0.0.1/user/ + test3.php = http://127.0.0.1/user/test3.php
                                                      ^-- note the difference


Your problem is when you call http://127.0.0.1/user/, you're like calling http://127.0.0.1/user/index.php. You should have a folder named user which inside it has the file index.php to make it work.

I suggest you rename user.php to index.php and move it to folder user.

0

精彩评论

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

关注公众号