title: Chat room refresh in JavaScript
body: <p>I'm working on a chatroom type thing where users type in text and hit enter and it gets posted to the main page. I built it with PHP. I have a working model, however to see new posts you have to click the refresh button in the browser. Is there a way to auto refresh this in JavaScript? I'm sure there is, but it seems like if it were to refresh every two seconds than it would be very slow and resource intensive. So is there a work-around? If not well than I guess we could just go with the refresh every few seconds.</p>
  
  <p>I'm now an advanced JavaScript user, so please comment your code and explain what I need to change. Thanks a million!!</p>
  
  <p>Oh, PS, All the comments are saved in a MySQL database and are auto-generated through PHP.</p>