Jquery UI Tabs with ajax content: Hrefs not working.

别来无恙 提交于 2019-12-11 15:08:33

问题


Trying to use UI Tabs to replace traditional links. However I have hit a snag with getting the href attribute to resolve to the specified url upon clicking the tabs.

Below is my html:

<div id = "tabs">
     <ul>
         <li><a href = "#main" >Main Content</a></li>
         <li><a href = "<?php echo base_url.'inventory/list' ?>">List</a></li>
         <li><a href = "<?php echo base_url.'inventory/add' ?>">Add</a></li>
         <li><a href = "<?php echo base_url.'inventory/edit' ?>">Edit</a></li>
    </ul>
 </div>

Jquery:

<script type="text/javascript">
   $(document).ready(function(){
    $('#tabs').tabs();
   })
</script>

Html Body:

<div id = "main">
<?php $this->load->view($main); ?>
</div>

Inspecting the UI Tabs using Firebug it shows e.g for List

http://localhost/inventory#ui-tabs-1

instead of (I imagine if it were to load the right content)

http://localhost/inventory/list#ui-tabs-1

Only the #main tab loads the correct content, nothing (other than Firebug inspection reading ui-tabs-x, where x is the index of the tab clicked ) changes upon clicking the other tabs.

Is there something I am missing? How can i do this better?

Thanks in advance.

来源:https://stackoverflow.com/questions/16210586/jquery-ui-tabs-with-ajax-content-hrefs-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!