jquery加载函数

jquery加载函数,jquery,Jquery,我有这个jQuery函数: $("#text").load("test3.php?id="+ Math.random()); 此代码位于第页: user.php 当我在此地址运行此页面时: -一切都好 但是,当我在这个地址中运行此页面时: 在div“text”中插入所有根页面 test3.php页面代码: <?php echo "test 678"; ?> 我不太明白这个问题,但有一点不同,因此这可能会有所帮助: 浏览器解析相对URL时,将使用文档位置。您的两个文档位置不同,其

我有这个jQuery函数:

$("#text").load("test3.php?id="+ Math.random());
此代码位于第页: user.php

当我在此地址运行此页面时: -一切都好

但是,当我在这个地址中运行此页面时:

在div“text”中插入所有根页面

test3.php页面代码:

<?php
echo "test 678";
?>

我不太明白这个问题,但有一点不同,因此这可能会有所帮助:

浏览器解析相对URL时,将使用文档位置。您的两个文档位置不同,其中一个看起来像是应该附加到
test3.php
的路径,另一个看起来像是应该替换的
test3.php
页面名称:

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

http://127.0.0.1/user/ +test3.php=http://127.0.0.1/user/test3.php
^--请注意差异您的问题在于调用
http://127.0.0.1/user/
,你就像在呼叫
http://127.0.0.1/user/index.php
。您应该有一个名为
user
的文件夹,其中包含文件
index.php
,以使其正常工作

我建议您将
user.php
重命名为
index.php
,并将其移动到文件夹
user

“在div'text'中插入所有根页面”是什么意思?恐怕我不明白。 http://127.0.0.1/user.php + test3.php = http://127.0.0.1/test3.php http://127.0.0.1/user/ + test3.php = http://127.0.0.1/user/test3.php ^-- note the difference