I have a problem and need a solution. I have a server sent event which gets updated to a div id everytime when there is a change in the database. Now my question is how to get the value from that div id and save it to a PHP variable.
<script>
if(typeof(EventSource)!=="undefined")
{
var source=new EventSource("bookcounterevent.php");
source.onmessage=function(event)
{
document.getElementById("bookcounter").innerHTML=event.data;
};
}
else
{
document.getElementById("bookcounter").innerHTML="Please update your browser!!";
}
</script>
<div id="bookcounter"></div>
The above codes update the <div id="bookcounter"></div>, I want the value which I receive at id bookcounter, I want to save it to a php variable say $book. How can that be done?
Thanks in advance.