2011-12-19 36 views
1

我正在使用jquery ajax get。使用jquery ajax時,仍然追加/添加參數到URL獲取

所以當我的表單被提交後,它會提交給一個php文件,但url保持不變,因爲我使用的是ajax。

$('#search').submit(function() { 

$.get("http://example.co.uk/ajax/post.php", $(this).serialize(), 
function(response){ 

    $('#content').html(response.content); 


    },"json"); 

return false; 
}); 

確定這個工作網址將保持不變。 www.example.com

好的,如果我刪除返回false,所以我得到的形式的默認功能我得到以下。

www.example.com?name=test&location=wales 

確定這裏就是我要找我想使用AJAX,但仍然有PARAMS附加到標題的原因是,我想我的網址與他人共享,以便它將從下拉PARAMS它。

例如

www.example.com // will just so the basic page 

www.example.com?name=test&location=wales // will show the page specific to wales 

任何幫助,請???

回答