function compteur()
{
    var xhr=null;
    
    if (window.XMLHttpRequest) { 
        xhr = new XMLHttpRequest();
    }
    else if (window.ActiveXObject) 
    {
        xhr = new ActiveXObject("Microsoft.XMLHTTP");
    }
    //on définit l'appel de la fonction au retour serveur
    xhr.onreadystatechange = function() { alert_ajax(xhr); };
    
    //on appelle le fichier reponse.txt
    xhr.open("GET", "compteur.php", true);
    xhr.send(null);
}

function alert_ajax(xhr)
{
    if (xhr.readyState==4) 
    {
        var doc = eval('(' + xhr.responseText + ')'); 
		//var nomMenu = document.getElementById('jsmenu');   // trouver un champ
	  	for ( i =0 ; i < doc.infoVisite.length ; i++ )
		{
			var nbVisite=doc.infoVisite[i].nbvisite;
			document.getElementById("compteur").innerHTML = doc.infoVisite[i].nbvisite;	
			//document.write(String(nbVisite));
		}
	}	
}
compteur();
