JohnOP Posted April 5, 2012 Share Posted April 5, 2012 I have a comment type of system that i am building which is using jquery to post the comments. When posting a new comment, the div that holds all the comments gets the new post added to it without page refresh which is all good and how i want it. I noticed though if i sign in to my website on another computer and am on the same page as the comments, only the one whom posted the comments div will update because its only them who are firing the form so any other user would have to refresh the page to see the new comment. <script type="text/javascript"> $('form[name=feedUpdate3]').submit(function(){ var id = <?php echo ($id) ?>; var share = $('.expand'+id).val(); var post_id = $('.post_id'+id).val(); $.post('updateFeeds.php', { share: share, post_id: post_id }, function(data){ $('#show_comments'+id).load('post_comments.php?post_id='+id); }); </script> #show_comments is the comments div I have a working solution which is to poll the comments div every so many seconds so all users would get updated with any new comments without having to refresh the page though i know that would cause heavy load on the server. I am just looking for another solution to this. Quote Link to comment https://forums.phpfreaks.com/topic/260370-need-to-poll-server/ 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.