How can I send a variable through Ajax and retrieve the value in PHP?
<script type="text/javascript">
setInterval(function(){
$.ajax({
async: true,
url: 'contalog.php',
dataType: 'html',
type: 'POST',
cache: false,
success: function(result){
// mandar a variavel $logado que vem do arquivo requisitado aqui acima ....
}
});
}, 1000);
</script>
And use it like this in my PHP, ...
echo $logado;
I need to Ajax
run from time to time, send it to the $logado
variable that is in PHP
.
I know if I use a include
it works but I need time to time via Ajax
to always have the variable updated.