Jump to content

Recommended Posts

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.

 

Link to comment
https://forums.phpfreaks.com/topic/260370-need-to-poll-server/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.