//globale Instanz von XMLHttpRequest
var xmlHttp = false;

//XMLHttpRequest-Instanz erstellen
//... für Internet Explorer
try {
    xmlHttp  = new ActiveXObject("Msxml2.XMLHTTP");
} catch(e) {
    try {
        xmlHttp  = new ActiveXObject("Microsoft.XMLHTTP");
    } catch(e) {
        xmlHttp  = false;
    }
}
//... für Mozilla, Opera, Safari usw.
if (!xmlHttp  && typeof XMLHttpRequest != 'undefined') {
    xmlHttp = new XMLHttpRequest();
}
 
//aktuelle Daten laden
loadSendeData();
 
//alle 5 Sekunden neue Daten holen
setInterval("loadSendeData()",4000);

function loadSendeData()
{
 if (xmlHttp) {
     xmlHttp.open('GET', 'modules/onair/controller.php?getdata=true', true);
     xmlHttp.onreadystatechange = function () {
         if (xmlHttp.readyState == 4) {
             document.getElementById("nowonair_ajax").innerHTML = xmlHttp.responseText;
         }
     };
     xmlHttp.send(null);
 }
}