HTML Editor
<!DOCTYPE html> <html lang="en-US"> <body> <h1>Live Data From Server</h1> <div id="myID"></div> <script> if( typeof(EventSource) !== "undefined"){ var eventSource = new EventSource("sse.php"); var x = document.getElementById("myID"); eventSource.onmessage = function(event){ x.innerHTML+= event.data + "<br>"; } } else{ x.innerHTML = "Sorry, your browser does not support server sent events"; } </script> </body> </html>
OUTPUT
×

Save as Private