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> Link to comment https://forums.phpfreaks.com/topic/173027-solved-need-help-with-checking-user/ Share on other sites More sharing options...
gaza165 Posted September 3, 2009 Author Share Posted September 3, 2009 Its ok, i have sorted it. Link to comment https://forums.phpfreaks.com/topic/173027-solved-need-help-with-checking-user/#findComment-911954 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.