C'è nessuno che può aiutarmi? il codice che era su txt era questo:

Javascript:
var MDiv;
function Inizializza(){
MDiv=document.getElementById("MainDiv");
var eSource=new EventSource("TargetJavaServer.php") //TargetJavaServer è nella stessa cartella dell'HTML, sefaccio un conole log fuori dal gestore "message" funziona

eSource.addEventListener("message", function(e){
console.log("salve"); //non funziona, è come se l'evento non fosse nemmeno scatenato;
MDiv.innerHTML=e.Data});
HTML:
<html><head>
<meta http-equiv="Content-Type" content="text/html charset=ISO-8859-1">
<title></title></head>
<body>
<?php
header("Content-Type:text/event-stream");
echo "data:messaggio\n\n";
flush();
?>
</body></html>
per favore help mee