Jump to content

Recommended Posts

I am looking at adding the ability to force all users viewing a page to receive an update to the page (a new text entry) at the moment that it is added by another user, something similar to they way chat rooms work.The active part that needs to show the live updates will be text in a textarea field. Currently any text typed into the textarea is automatically inserted into a database with the use of javascripts onkeyup() and some ajax. Other users are required to refresh there page to see the latest updates in the textbox and this is the bit that I would like to avoid.I haven't ever needed to do this before so don't have knowledge of what would be the best way to go about this.

  • Like 6
Link to post
Share on other sites

The issue I have is how to update multiple textarea boxes on the same page. They are created dynamically so numbers can be anywhere from 1 to 100 boxes, each linked to a different row in the database. If it was just updating 1 box then I could achieve this with some JS but with so many boxes I can see it struggling to handle the volume. Any ideas how to get round this, I can't reduce the number of boxes.

Link to post
Share on other sites
  • 2 weeks later...

I tested the update using 100 boxes which is about the most I will see on the page and the javascript was slowing the page down slighty which was a problem as the page cant afford for this to happen.I made a different solution using a simple mouseover on each textarea that fetches the latest content for the textarea from the mysql server and redisplays it in the textarea. As a user puts there cursor in the textarea to type a message it activates the update and redisplays the message before they can type over it. As it only affects each textarea individually it massively reduces the update time.

Link to post
Share on other sites

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.   Paste as plain text instead

  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.

Loading...
×
×
  • Create New...