var source = new EventSource("getweather.php"); source.onmessage = function(event) { document.getElementById("result").innerHTML += event.data + "
"; };