Is there a way to make this script run in real-time, rather than using setInerval()? I do not know where to begin.

Code:
$(window).load(function(){
    setInterval(function(){
    var username=_userdata['username'];
    var username=_userdata['username'];
    $.get('/notification.forum',function(data){
         var b= data.unread;
        if(b >= 1){
          var c = data.store;
          for(var keys in c){
            var d = c[keys];
           if(d.read === 0){
            var e= d.text.type;
            var from= d.text.from.name;
            var topic = e===7 ? "in the topic "+d.text.post.topic_name.replace(/-/g,' ') : "";
            var type= Notify(e);
              createNotifcation('http://i.imgur.com/LPVUvcf.png',username + ' you have a new notification!',type + " from "+from+"  "+topic);
           }
          }
         }
       });
    },5000);
       });
Edit:
I found this:

Code:
function listen() {
        $.get("/mylongrequestfile", {}, function(data) {
        	$("#mydiv").html(data);
        	listen(); // then launch again
        }));
    };
How do i include this into my script ? Or how to i make this in real time.. (my initial script..)