sidebar "category" selection and showing features PHP

I am working on an e-commerce site. After registration client will have an admin panel and have facilities enter image description here

when client click on "inbox" it will show his "massages" and when click on "sent box" it will show 'sent massages' but now when I click on "inbox"/"sent box" all the feature are coming on the same page .enter image description here

I don't want to show them on same pages .. for now i am using this code

<div id="inboxdiv" >
                    
                    <script>
    function inbox() {
        $("#inboxdiv").load("member/inbox.php");
    }
                    </script>
                    </div>
                    <div id="sentboxdiv" >
                    
                    <script>
    function sentbox() {
        $("#sentboxdiv").load("member/sentbox.php");
    }
                    </script>
                    </div>
<ul class='w-list'>
					<li class='w-list-item'><a class='link' href="javascript:inbox()">Inbox</a></li>
					<li class='w-list-item'><a class='link' href="javascript:sentbox()">Sent Box</a></li>
</ul>

Answers 1

  • You need to clear previous div when new link is clicked. Check this solution:

    <div id="inboxdiv" class="content_data">
    
                        <script>
        function inbox() {
           $(".content_data").html("");
            $("#inboxdiv").load("member/inbox.php");
        }
                        </script>
                        </div>
                        <div id="sentboxdiv" class="content_data">
    
                        <script>
        function sentbox() {
             $(".content_data").html("");
            $("#sentboxdiv").load("member/sentbox.php");
        }
                        </script>
                        </div>
    

Related Articles