![](/img/trans.png)
[英]How to add page number in footer using JavaScript or CSS while print?
[英]How to add page number using Ajax, Javascript?
我有問題:有一個用於使用Jquery(Ajax)更改和加載異步頁面的腳本:
$('.page_button').live('click',function() {
$('#ajaxBusy').show();
$('.selected_page_button').attr('class','page_button');
$(this).attr('class','selected_page_button');
$.post("http://"+document.location.host+"/index.php/welcome/update_records_set/"+this.id,
function(data)
{
if (data != "")
{
$(".records_content:last").empty();
$(".records_content").html(data);
}
$('#ajaxBusy').hide();
});
});
此代碼有效,但我還需要為URL添加“ #page”而不刷新。 另外,我使用CodeIgniter進行開發,並且此功能從某些控制器加載頁面:
public function language_testing($language_code) {
//some actions
}
但是,如何從“ http://some_site/controller/en#5
”中提取頁碼以加載第五頁? 是否有它的標准呢?
如果您是想從url獲取哈希值,則可以執行以下操作:
var hassh = window.location.hash;
var hashVal = hassh.substr(1, hassh.length);
console.log( hashVal );
如果您想從網址獲取,則:
var url = "http://some_site/controller/en#5".split("#");
console.log( url[1] );
您可以將哈希設置為:
window.location.hash = "#yourValue";
你的意思是那樣的嗎
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.