gaza165 Posted September 3, 2009 Share Posted September 3, 2009 Hello I am designing a private messaging service on a browser. At the moment i have created the code which allows the user to click on the user they wish to have a PM with and then display the div to send a message to that user. I need to come up with a way of checking that the user is not 'already' having a private conversation with the user they click on. So if they click on 'Admin', then the box to write a PM will come up... but if they click 'Admin' again, a box should not appear. Below is my function.... <script> function Get_Users() { $.ajax({ type: "GET", url: "action/whosonline.php", success: function(data){ $("ul.whosonline").html(data); $('ul.whosonline li:even').css('background-color','#DEDEDE'); $('ul.whosonline li:odd').css('background-color','#EDEDED'); $('ul.whosonline li').click(function() { //if the user clicks on another user if(id != 4 && data != '<li>No Users Online</li>' && lock != 1) { id = id+1; $("#slidebottom").append( "<div class='"+id+"' id='chatinner'><div class='username'>"+user+"</div><ul class='pm'><li></li></ul><input type='text' name='message'></div>"); right = right + 220 $('.'+id).css('right',right); $('.'+id).hide(); $('.'+id).fadeIn(); } }); } }); } </script> Quote Link to comment Share on other sites More sharing options...
gaza165 Posted September 3, 2009 Author Share Posted September 3, 2009 Its ok, i have sorted it. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.