【发布时间】:2011-04-16 06:10:12
【问题描述】:
我有这个 jquery 函数,我想将 topic 参数传递给,我只是不知道如何传递它,哈哈 :))。
jquery 函数:
function loadPage(url) //the function that loads pages via AJAX
{
url=url.replace('#page',''); //strip the #page part of the hash and leave only the page number
$('#loading').css('visibility','visible'); //show the rotating gif animation
$.ajax({ //create an ajax request to load_page.php
type: "POST",
url: "load_page.php",
data: 'page='+url, //with the page number as a parameter
dataType: "php", //expect html to be returned
success: function(msg){
if(parseInt(msg)!=0) //if no errors
{
$('#change-container').html(msg); //load the returned html into pageContet
$('#loading').css('visibility','hidden'); //and hide the rotating gif
}
}
});
}
这是网址:
http://localhost/final/home.php#page2&topic=jquery
当我点击这个链接时,页面加载罚款(使用 jquery),但它没有传递主题参数!
<h3 class="timeline"><?php echo $_GET["topic"]; ?> echo</h3>
所以这个 wnt 回显,因为它 cnt 访问主题参数!如果你们知道我的意思:))
【问题讨论】:
标签: php javascript jquery url get