title: Refreshing database information via PHP function with Javascript
body: <p>I'm trying to get a span to refresh with a php function which queries the database for spaces. However, I can't figure out how to keep it refreshing the actual database content dynamically (preferably via a timer). Here's what I have so far    </p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  window.onload = startInterval;
  function startInterval()
  {
          setInterval("startTime();",1000);
  }
  
  function startTime()
  {
      document.getElementById('spaces').innerHTML = &lt;?php echo get_spaces($id)?&gt;;  
  }
  &lt;/script&gt;
  </code></pre>