title: How to compare strings in jQuery
body: <p>In this code I am trying to compare two strings with jQuery. The current content of a div and the new content, loaded from a (currently) static page.</p>
  
  <p>But it doesn't work, when the loaded content is the same as the current content, it still loads the new content...</p>
  
  <p>When I view the content vars, they really are equal (I used the JS alert).</p>
  
  <pre><code>$(document).ready(function () {
      var refreshId = setInterval(function () {
          $.get("ajaxGetEvents.aspx", function (data) {
              if ($('#events').html() != data) {
                  $('#events').fadeOut('slow', function () {
                      $(this).load('ajaxGetEvents.aspx').fadeIn('slow');
                  });
              } else {
                  alert("item is equal");
              }
          });
      }, 5000);
  });
  </code></pre>