title: Stopping setInterval and executing the rest of the code
body: <p>So if the condition of $('#purple-title').html() != "PLEASE SCAN YOUR CARD" is met, I'd like to exit the interval and do what is inside of that if() function.</p>
  
  <p>My problem has been solved and the following code works just fine!</p>
  
  <pre class="lang-js prettyprint-override"><code>    $(document).ready(function() {
        $.ajaxSetup({
          cache: false
        });
        var refreshID = setInterval(function() {
  
          $('#purple-title').load('dbcheck.php');
          if ($('#purple-title').html() != "PLEASE SCAN YOUR CARD") {
  
            clearInterval(refreshID);
  
            $("#waiting-for-signal").animate({
              opacity: '0'
            }, 300);
            $("#purple-title").animate({
              opacity: '0'
            }, 300);
            setTimeout(function() {
              $("#waiting-for-signal").css("visibility", "hidden");
              $("#purple-title").html("Welcome!");
              $("#screen").prepend('&lt;img id="checked" src="assets/check.gif"/&gt;');
              $("#screen").prepend('&lt;p id="purple-title" class="purple-title" style="margin:20px 0px 0px 0px;"&gt;WELCOME&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;ALEN ŠIMUNIC&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;UID: 31.42.43.25&lt;/p&gt;');
              $("#checked").css("opacity", "1");
            }, 300);
            $("#purple-title").animate({
              opacity: '1'
            }, 300);
            setTimeout(function() {
              $("#purple-title").animate({
                opacity: '0'
              }, 300);
              $("#checked").animate({
                opacity: '0'
              }, 300);
            }, 2200);
            setTimeout(function() {
              location.reload();
            }, 2500);
          }
  
        }, 500);
      });
  </code></pre>