Jump to content

Jquery load in codeigniter views


s_ainley87

Recommended Posts

Hello,

 

I am working on a one page website that allows the users to add and remove pages from there navigation as and when they would like too, the way it works is that if the click 'Blog' on the main nav a 'Blog' section should appear on the page, if they then click 'News' the 'News' section should also be visible, however the way I have started to implement this it seems I can only have one section at a time, can my code be adpated to allow multiple sections to shown on the main page.

 

Here is my code for the page that has the main menu and the users selections on it.

 

 <!DOCTYPE html>
<head>
    <title>Development Site</title>
    <link rel="stylesheet" href="/media/css/reset.css" media="screen"/>
    <link rel="stylesheet" href="/media/css/generic.css" media="screen"/>
    <script type="text/javascript" src="/media/javascript/jquery-ui/js/jquery.js"></script>
    <script type="text/javascript" src="/media/javascript/jquery-ui/development-bundle/ui/ui.core.js"></script>
    <script type="text/javascript" src="/media/javascript/jquery-ui/development-bundle/ui/ui.accordion.js"></script>
    <script type="text/javascript">
    $(document).ready(function() {
                $('a.menuitem').click(function() {
                        var link = $(this), url = link.attr("href");
                            $("#content_pane").load(url);
                            return false; // prevent default link-behavior
                });
     });
       </script>
    </head>
    <body>
        <li><a class="menuitem" href="inspiration">Inspiration</a></li>
        <li><a class="menuitem" href="blog">Blog</a></li>
        <div id="content_pane">

        </div>
    </body>
    </html>

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.