title: Ampersand Symbol (&) turning into &amp;
body: <p>I use the following code to automatically grab/set the latest page title every 30 seconds:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
     setInterval(function() {
        var data = "http://mysite.com/mypage.php";
        $.get(document.location.toString()).then(function (data){
        //find and set the title of the page
        document.title = data.match(/&lt;title&gt;(.+)&lt;\/title&gt;/)[1];
          });
      }, 30000);
  &lt;/script&gt;  
  </code></pre>
  
  <p>It works great, except for titles which include an ampersand. These load normally, and then after 30 seconds are replaced with:</p>
  
  <pre><code>&amp;amp;
  </code></pre>
  
  <p>So if the page title is:</p>
  
  <pre><code>Fun &amp; Games
  </code></pre>
  
  <p>After 30 seconds, it becomes:</p>
  
  <pre><code>Fun &amp;amp; Games
  </code></pre>
  
  <p>Thanks</p>