title: How to refresh a Div every 10 seconds without refreshing the entire page?
body: <p>I'm working on a website platform that doesn't allow for any server sided scripting, so jquery and javascript are pretty much all I have to work with. I am trying to create a script to work with the site that will update a div that contains an inbox message count every 10 seconds. I've been successful with making the div refresh every ten seconds, but the trouble lies in the page views count. My script is refreshing the whole page and counting for a page view, but I only want to refresh just the one div. An example of the trouble my script causes is when viewing anything on the site that has a page view counter (forum posts, blog posts, ect...), the page views go crazy because of the script refreshing. I'm pretty new to Javascript, so I'm not entirely sure there is a way around this.</p>
  
  <p>What I'm working with is below:</p>
  
  <pre><code>    &lt;div id="msgalert" style="display: none"; "width: 100px !important"&gt;
  &lt;a href=""&gt; You have $inbox_msg_count new messages.&lt;/a&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>$inbox_msg_count</strong> is a call that grabs the message count, and provided by the platform the site is on. It displays the message count automatically when used.</p>
  
  <p>Then the script that does all the work is this:</p>
  
  <pre><code>    &lt;script&gt;
   setInterval(function(facepop){
    var x= document.getElementById("SUI-WelcomeLine-InboxNum");
  var z = x.innerText;
   if(x.textContent.length &gt; 0)
  $("#msgalert").show('slow');
  }, 1000);
  facepop();
  &lt;/script&gt;
  &lt;script&gt;
  setInterval(function() {  
  $("#msgalert").load(location.href+" #msgalert&gt;*","");  
  }, 1000); // seconds to wait, miliseconds
  &lt;/script&gt;
  </code></pre>
  
  <p>I realize I've probably not done the best job of explaining this, but that's because I'm pretty confused in it myself. Like I mentioned previously, this code function just how I want it, but I don't want it to refresh the entire page and rack up the page views. Any help is much appreciated.</p>