I cannot figure out how to stop my setinterval code. I've seen the other posts on stackoverflow however nothing works.
$(document).ready(function() {
  var content =  tinyMCE.getContent('content').value;
});
var myinterval = setInterval(function() {
  $.get("status.php?id=<?php echo $id; ?>",function(data){     
    val = content.value;
    if (val != data) {
      $.pnotify({
        title: 'Regular Notice',
        text: 'Check me out! I\'m a notice.'
      });
      clear();
    }
  });
}, 1000 * 2 * 1); 
function clear(){
    clearInterval(myinterval);
}
 
     
    