title: Javascript not calling functions
body: <p>The function called by onLoad is called but stops before calling another function.
  I'm sure this is what is happening because I added some debugging <code>document.write()</code> functions.</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"&gt;&lt;/script&gt;
  &lt;script&gt;
  function getTemp(){
      document.write("3");//debugging
      $.ajax( {
          type: "GET",
          url: "gettemp.php",
          success:function(data){
              document.write(data);
              document.write("4"); //debugging
          }
      });
  }
  
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body onload="onLoad();"&gt;
  &lt;script&gt;
  function onLoad(){
      document.write("1"); //debugging
      getTemp();
      document.write("2"); //debugging
      setInterval(function(){getTemp();}, 10000);
  }
  &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>It outputs only "1", nothing else. Therefore, I am certain it stops before calling getTemp(). If necessary I will add the php file. As for the split scripts, if you put the onLoad() script in the head script you end up with nothing, not even the "1".</p>
  
  <p>EDIT: Now it gets to "132", but it seems it isn't calling the PHP correctly. </p>
  
  <p>PHP source:</p>
  
  <pre><code>&lt;?php
  getTemp();
  function getTemp()
  {
          $filename = "temp";
          $f = fopen($filename,"r");
          $value = fgets($f);
          $value = $value / 100;
          echo $value;
  }
  ?&gt;
  </code></pre>