Jump to content

gamesmstr

Members
  • Posts

    140
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

gamesmstr's Achievements

Member

Member (2/5)

0

Reputation

  1. Please See above. As I stated before, I am NOT interested in jQuery. The AJAX works fine and has for years. I'm not going to go recode my site after 6 years just to say I have jQuery. What I am adding is just a little perk and is more related to how to change the page title from inside an ajax called php file than the javascript itself.
  2. I have a game website. I want to be able to change the page title to alert players when a new news item affects them. I routinely use refreshing AJAX calls to refresh stats etc. These AJAX calls refer to a seperate php file. I have tried everything I can think of, but the solution eludes me. Here is the AJAX call (NO I am not interested in Jquery) function createXMLHttpRequest() { if (typeof XMLHttpRequest != 'undefined') { return new XMLHttpRequest(); } try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } return false; } function refresh_stats() { var xmlHttp3 = createXMLHttpRequest(); params = ''; xmlHttp3.open("POST","ajax/statsajax.php", true); xmlHttp3.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); xmlHttp3.onreadystatechange = function() { if(xmlHttp3.readyState == 4 && xmlHttp3.status == 200) { var brokenstring = xmlHttp3.responseText.split("-@[-"); if ( brokenstring[0] == 'stats' ) { document.getElementById("statbox").innerHTML = brokenstring[1]; } } } xmlHttp3.send(params); statupdate=setTimeout("refresh_stats()", 60000); } Here is a snippet of the PHP code that I am working with if ($timecheck1['id'] > $player['news']) { echo("<i><font color=red> * News! *</font></i>"); ?> <script type="text/javascript">document.title = "*News!* Immortalix";</script> <?php } else {?> <script type="text/javascript">document.title = "Immortalix";</script> <?php } I am assuming that it is not working because it is being called from a different document. Any suggestions would be most helpful.
×
×
  • 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.