Posted By

FatFolderDesigner on 12/03/10


Tagged

fix javascript php chat


Versions (?)

PHP-Lively Auto Refresh Fix


 / Published in: JavaScript
 

URL: http://fatfolderdesign.com/64/hacks/php-lively-refresh-fix

PHP-lively wasn't auto refreshing on the public server (although was on my personal testing server before I implemented it on the live one) so I had to find a fix. Unfortunately the code is commented in another language (Spanish i think) and it took a little poking and prodding to find out what I needed to do and where I needed to do it.

This solution should be placed at the end of the UpdateTimer() function, around line 183 or so. The UpdateTimer() function is located at the bottom of the chat.js file (located in master/js).

The solution works by faking a refresh without content, same as hitting enter with a blank text field. It is very much a hack fix and should only be used if your server isn't allowing the script to refresh the way it is already programmed.

  1. httpRequest.open('POST', 'index.php', true);
  2. httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
  3. httpRequest.onreadystatechange = function() { traer_contenido(httpRequest); };
  4. vis_data = "modo=escribir_msg&sid=" + sid + "&nick=" + encodeURIComponent(chatnick.value) + "&email=" + encodeURIComponent(chatemail.value) + "&msg=";
  5. httpRequest.send(vis_data);

Report this snippet  

You need to login to post a comment.