0
I’m using javascript to update a div every 5 seconds, and every 5 seconds div updates, but is creating several div equal.
I have the following code:
session_start();
$url ="http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
$_SESSION['URL'] = $url;
echo(" <script>
$(document).ready(function(){
$('#chatDiv').load('$url');
var refreshId = setInterval(function(){
$('#chatDiv').load('$url');}, 5000);
$.ajaxSetup({ cache: false});
});
</script>");
What returns from the URL you are loading into the div
#chatDiv?– Sam
I’m getting the current page url
– Luiz Ricardo
Just remembering that this
HTTP_HOSTis vulnerable, anyone can change it, since part of the header sent by the client. That is, changing this you will make a request to another site...– Inkeliz