title: Javascript div refresh
body: <p>I am trying to refresh a php script to show updated content as a database updates.  I first built my php, then the code to refresh and then merge them.  However, the script doesn't update.  Anyone know why?</p>
  
  <pre><code>&lt;script type="text/javascript"
      src="http://code.jquery.com/jquery-1.10.1.min.js"&gt;&lt;/script&gt;
  &lt;script&gt;
      $(document).ready(
              function() {
                  setInterval(function() {
                      if(document.getElementById('gallery') != null){
                          function showLots() {
                              if (window.XMLHttpRequest) {
                                  // code for IE7+, Firefox, Chrome, Opera, Safari
                                  xmlhttp = new XMLHttpRequest();
                              } else {
                                  // code for IE6, IE5
                                  xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
                              }
                              xmlhttp.onreadystatechange = function() {
                                  if (xmlhttp.readyState == 4 &amp;&amp; xmlhttp.status == 200) {
                                      document.getElementById("gallery").innerHTML = xmlhttp.responseText;
                                  }
                              }
                          xmlhttp.open("GET","getuser.php",true);
                          xmlhttp.send();
                          } 
                      }
                  }, 3000);
              });
  &lt;/script&gt;
  </code></pre>
  
  <p>Thanks.</p>