简体   繁体   English

如何在异步页面加载时更改导航URL

[英]how to change navigation url on async page loads

I have used the following script but it doesn't show the url of link. 我使用了以下脚本但它没有显示链接的URL。

<a href="<?php echo base_url();?>admin/football_manage/form" class="loadpage">add</a>
<div id="right_side_contnet"></div>

$(document).ready(function(){ 
   $('.loadpage').click(function(e){ 
      e.preventDefault() 
      $('#right_side_contnet').load(this.href) 
   }); 
});

Ajax navigation can't simply change the browser history, and this is actually what you are looking for I suppose. Ajax导航不能简单地改变浏览器历史记录,这实际上是我想要的。 This can be achieved by making use of history API introduced in HTML5 either by 这可以通过使用HTML5中引入的历史API来实现

  1. Manipulating the history manually by the history API. 通过历史API手动操作历史记录。 MDN , html5doctor MDNhtml5doctor
  2. Use well implemented third party libraries for manipulating history. 使用良好实施的第三方库来操纵历史记录。 I'd suggest pjax or history.js 我建议使用pjaxhistory.js

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM