title: JavaScript diceRoller only works in Chrome
body: <p>The code below only works with google chrome, if I try to use any other browser it just wont work. I suspect it has something to do with the datatype I'm sending to php. However, I'm not entirely sure.</p>
  
  <p>Link to where the code is hosted: <a href="http://coldrepublic.com/diceRoller(1).html" rel="nofollow noreferrer">http://coldrepublic.com/diceRoller(1).html</a></p>
  
  <p>Code:</p>
  
  <p>PHP</p>
  
  <pre><code>&lt;?php 
  if(!empty($_POST['data']))
      { $data = $_POST['data']; 
      $file = 'log.txt';
      // Open the file to get existing content
      $current = $data;
      // Append a roll to the file
      $current .= file_get_contents($file);
      // Write the contents back to the file
      file_put_contents($file,$current);
  }
  else{
      $file = 'log.txt';
      // Open the file to get existing content
      $current = "No Value sent\n";
      // Append a new person to the file
      $current .= file_get_contents($file);
      // Write the contents back to the file
      file_put_contents($file, $current);
  }
  </code></pre>
  
  <p>?></p>
  
  <p>Javascript/HTML</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;style&gt;
  
  #CharacterLabel {margin-right:110px}
  #ActionLabel {margin-right:125px}
  #NumOfDiceLabel {margin-right:60px}
  #SidesLabel {margin-right:20px}
  
  &lt;/style&gt;
  &lt;/head&gt;
  &lt;body onload="myFunction()"&gt;
  &lt;p&gt;&lt;label id="CharacterLabel" for="CharacterInput"&gt;Character:&lt;/label&gt; 
  &lt;label id="ActionLabel" for="ActionInput"&gt;Action:&lt;/label&gt;
  &lt;label id="NumOfDiceLabel" for="NumDice"&gt;Number of Dice:&lt;/label&gt;
  &lt;label id="SidesLabel" for="Sides"&gt;Sides:&lt;/label&gt;
  &lt;label id="BonusLabel" for="BonusInput"&gt;Bonus:&lt;/label&gt;&lt;/p&gt;
  &lt;p&gt;&lt;input type="text" name="Character" id="CharacterInput" /&gt;
  &lt;input type="text" name="Action" id="ActionInput" /&gt;
  &lt;input type="text" name="NumberOfDice" id="NumDice" /&gt;
  &lt;select id="Sides"&gt;
   &lt;option value="3"&gt;d3&lt;/option&gt;
   &lt;option value="4"&gt;d4&lt;/option&gt;
   &lt;option value="6"&gt;d6&lt;/option&gt;
   &lt;option value="8"&gt;d8&lt;/option&gt;
   &lt;option value="10"&gt;d10&lt;/option&gt;
   &lt;option value="12"&gt;d12&lt;/option&gt;
   &lt;option value="20" select="selected"&gt;d20&lt;/option&gt;
   &lt;option valoue="100"&gt;d100&lt;/option&gt;
  &lt;/select&gt;
  &lt;input type="text" name="Bonus" id="BonusInput" /&gt;&lt;/p&gt;
  &lt;p&gt;&lt;button onclick="rollDice()" style="width:100px; height:50px;"&gt;Roll Dice&lt;/button&gt;&lt;/p&gt;
  &lt;p&gt;&lt;textarea name="Output" id="OutputBox" rows="10" cols="100" readonly="true"/&gt;&lt;/textarea&gt;&lt;/p&gt;
  &lt;label id="ErrorLog"&gt;Message:&lt;/label&gt;
  
  &lt;script&gt;
  
  function getXMLHttpRequestObject(){
   var ajaxWork=null;
   if(window.XMLHttpRequest){
    ajaxWork = new XMLHttpRequest();
   }
   else if (window.ActiveXObject){
    ajaxWork = new ActiveXObject('MSXML2.XMLHTTP.3.0');
   }
   return ajaxWork;
  }
  
  function callAjax(ajaxWork)
  {
   ajaxWork.open('GET', 'http://coldrepublic.com/log.txt', true);
   ajaxWork.send(null)
  }
  
  function writeToLog(toLog)
  {
   var data = new FormData();
       data.append("data",toLog);
   
   var xhr = getXMLHttpRequestObject();
   xhr.open( 'POST', 'http://coldrepublic.com/writeToLog.php', true );
  
   xhr.send(data);
  }
  
  function myFunction(){
  
   var ajaxWork = getXMLHttpRequestObject();
  
   ajaxWork.onreadystatechange = function(){
    if(ajaxWork.readyState == 4){
     if((ajaxWork.status &gt;=200 &amp;&amp; ajaxWork.status &lt; 300)
     || (ajaxWork.status == 304)){
      document.getElementById('OutputBox').value = ajaxWork.responseText;
     
     }
     else{
      document.getElementById('ErrorLog').innerHTML = "Message: Error! Did not properly read file";
     }
    }
   }
   
   callAjax(ajaxWork);
  }
  
  function rollDice(){
   var character = document.getElementById("CharacterInput").value;
   var action = document.getElementById("ActionInput").value;
   var sides = parseInt(document.getElementById("Sides").value);
   var diceRolls = "";
   var toLog = "";
   
   var OutputBox = document.getElementById('OutputBox');
  
   document.getElementById('ErrorLog').innerHTML = 'Message:';
  
   var bonusBlank = document.getElementById("BonusInput").value;
  
   if(character == null || character == "",action == null || action == "")
   { 
  
    document.getElementById('ErrorLog').innerHTML = 'Message: Error! Must enter value for Character or Action.';
   }
   else
   {
    if(isInt(parseInt(document.getElementById("NumDice").value)) &amp;&amp; isInt(parseInt(document.getElementById("BonusInput").value)))
    {
     var numDice = parseInt(document.getElementById("NumDice").value);
     var bonus = document.getElementById("BonusInput").value;
  
      for (i=0; i &lt; numDice; i++)
     {
      var numTemp = Math.floor(Math.random() * sides) +1;
      var strTemp = numTemp.toString();
      diceRolls = diceRolls.concat(" " + strTemp);
     }
    
     var outTemp = "";
     var outTemp = outTemp.concat();
     var dateTemp = timeStamp();
     
     toLog = character + " " + action + " " + diceRolls + " Bonus: " + bonus + " Timestamp: " + dateTemp + "\n" ;
     writeToLog(toLog);
     location.reload();
     location.reload();
    }
    else
    {
     if(bonusBlank == null || bonusBlank == "")
     {
      var numDice = parseInt(document.getElementById("NumDice").value);
      var bonus = 0;
  
       for (i=0; i &lt; numDice; i++)
      {
       var numTemp = Math.floor(Math.random() * sides) +1;
       var strTemp = numTemp.toString();
       diceRolls = diceRolls.concat(" " + strTemp);
      }
    
      var outTemp = "";
      var outTemp = outTemp.concat();
      var dateTemp = timeStamp();
      
      toLog = character + " " + action + " " + diceRolls + " Bonus: " + bonus + " Timestamp: " + dateTemp + "\n";
      writeToLog(toLog);
      location.reload();
      location.reload();
     }
     else
     {
      document.getElementById('ErrorLog').innerHTML = 'Message: Error! Entered non-integer value for Number of Dice or Bonus.';
     }
    }
   }
  }
  
  function isInt(value) {
    return !isNaN(value) &amp;&amp; 
           parseInt(Number(value)) == value &amp;&amp; 
           !isNaN(parseInt(value, 10));
  }
  
  function timeStamp(){
   // Create a date object with the current time
     var now = new Date();
  
   // Create an array with the current month, day and time
     var date = [ now.getMonth() + 1, now.getDate(), now.getFullYear() ];
  
   // Create an array with the current hour, minute and second
     var time = [ now.getHours(), now.getMinutes(), now.getSeconds() ];
  
   // Determine AM or PM suffix based on the hour
     var suffix = ( time[0] &lt; 12 ) ? "AM" : "PM";
  
   // Convert hour from military time
     time[0] = ( time[0] &lt; 12 ) ? time[0] : time[0] - 12;
  
   // If hour is 0, set it to 12
     time[0] = time[0] || 12;
  
   // If seconds and minutes are less than 10, add a zero
     for ( var i = 1; i &lt; 3; i++ ) {
       if ( time[i] &lt; 10 ) {
          time[i] = "0" + time[i];
       }
    }
  
   // Return the formatted string
     return date.join("/") + " " + time.join(":") + " " + suffix;
   
  }
  &lt;/script&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>