Jquery.get() not working with new div content

Jquery.get() not working with new div content

Hi there,

I've got a strange problem...

I have my code:

jQuery(".statusLink").click(
                    function()
                    {
                        alert('click');
                        jQuery.get('<?php echo base_url()."index.php/profile/"; ?>'+ jQuery(this).attr('id'),
                         function(data){
                             jQuery("#statusBar").html(data);
                         });
                    }
                );

My html is as follows:

 <div class="span-11 last" id="statusBar">
                <p>You are currently <?php echo $this->session->userdata('user_chat_status'); ?>
                   (<?php
                        if ($this->session->userdata('user_chat_status') == "Online")
                        {
                            echo '<a href="#" id="GoOffline" class="statusLink">Go Offline</a>';
                        }
                        else
                        {
                            echo '<a href="#" id="GoOnline" class="statusLink">Go Online</a>';
                        }

                    ?>)
                </p>
            </div>

Initially the user is online.... when you click "Go Offline" the data in the div "statusBar" is updated:

function GoOffline()
   {
       $this->chat->user_is_offline($this->session->userdata('userId'));
       $this->session->set_userdata('user_chat_status',  'Offline');

       echo '<p>You are currently '.$this->session->userdata('user_chat_status').' (<a href="#" id="GoOnline"        class="statusLink">Go Online</a>)</p>';
   }

So the new content in the div is updated with the red text above.

But now if i click on "Go Online" link the jquery.click method is not working on this new data...

I hope this makes sense?

I want the user to be able to go online and offline without refreshing the page....

In a nutshell... the problem is that the first time i click go offline the div content is updated and now the user has a link for going online again. But if they click go online nothing happens.... (doesnt seem to be picking up the users click anymore)

Please can someone advise me on this...

Many thanks