【发布时间】:2011-12-01 13:59:32
【问题描述】:
我使用 JQuery Address 进行相当简单的 ajax 导航,使用 index.php 将页面加载到容器中。这是jquery:
$.address.change(function(event) {
// Get URL:
var url = event.value.replace('/','');
if (url != '') {
$('#internalcontent').load(url);
}
});
$('a').livequery('click',function() {
$.address.value($(this).attr('href'));
return false;
});
这适用于大多数链接(例如 test.php)和一些查询字符串(例如 test.php?id=3)。但它不适用于带有像 test.php?d=4&c=2 这样的查询字符串的 URL。相反,它只是将此页面加载到一个空白窗口中,而不是加载到容器 div 中。我对地址很新,我确信这很简单,但我无法弄清楚为什么两个示例之间存在不一致,即为什么它适用于 test.php?id=3 但不适用于测试。 php?d=4&c=2.
非常感谢任何建议!
【问题讨论】:
-
你确定你的新 test.php 对 $_GET['d'] 和 $_GET['c'] 的出现都有响应吗?
-
是的。 test.php 加载并显示正确的信息,但它没有加载到 index.php 中的中,它只是出现而不是 index.php。
标签: php jquery navigation query-string jquery-address