Grazie innanzitutto per le risposte...
Ho provato a fare come diceva andr3a va non funziona, continua a stamparmi solo la scritta "ciao" + il tempo, e non ne vuole a che sapere per quanto concerne l'esecuzione dello script alert('funziona');
Questo è il codice che ho utilizzato (seguendo le istruzioni di andr3a):
codice:
<script>
function refreshDate(myUrl,myField){
var Field = document.getElementById(myField); // selects the given element

	if(window.XMLHttpRequest) {
		xmlhttp = new XMLHttpRequest(); // Gecko (Firefox, Moz), KHTML (Konqueror, Safari), Opera, Internet Explorer 7    
	}
	
	if(window.ActiveXObject) {
		try{        
			xmlhttp = new ActiveXObject("MSXML2.XMLHTTP"); // Internet Explorer 6     
			} catch(e) { 
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); // Internet Explorer 4,5    
			}    
	}    

		xmlhttp.open("GET", myUrl+ '?rnd=' + Math.random(), true);    
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState == 4) {             
				Field.innerHTML = xmlhttp.responseText; // puts the result into the element
				     
			}    
		}    
		xmlhttp.send(null); 
		
}
</script>

<body onload="myUrl = 'azione.php'; myField = 'richieste'; refreshDate(myUrl, myField); setInterval('refreshDate(myUrl, myField);', 2000);">
<p id="richieste"></p>
</body>
Vi ringrazio ancora per l'aiuto!