hi,
i have menubar.click menubar content
load the particular url in this page.

$(document).ready(function(){
       $('#menubar li a').click(function(e){
        e.preventDefault();
        $('#userpersonal').load("http://localhost/user/web/personal/index");


        });
    });

what is the problem in my code.
plz help me

Recommended Answers

All 5 Replies

Looks okay, what is the problem?

Looks like jQuery. Are you loading the jQuery library in the <head> section of your page?

the page did not load in the div tag.click link button redirect page.

This is the menu bar code.

<ul id="menubar" class="menuBarHorizontal">
    <li><a class="MenuBarItemSubmenu" href="#">Homepage</a>
    <ul>
    <li><a href="<?php echo url_for("@picture") ?>" >Pics</li>
    <li><a href="<?php echo url_for("@personal") ?>" > Profile</li>
    <li><a href="<?php echo url_for("@myplans") ?>" > My Plans</li>
    <li><a href="<?php echo url_for("@mypeople") ?>" > People</li>
    </ul>
    </li>
    </ul>
    <div id="userpersonal" class="float-left" >
        </div>

If you want to access the other anchor elements directly, you'll need to access via:

\'#menubar li ul li a'

Why not just apply the same class to the group of links you want to target?

try this

 $(document).ready(function(){
           $('#menubar').attr('href').click(function(e){
            e.preventDefault();
            $('#userpersonal').load("http://localhost/user/web/personal/index");
            });
        });


havent test it yet
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.