0
How can I send a variable through Ajax and recover 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 the Ajax
run from time to time, send to the variable $logado
that is in the PHP
.
I know if I wear one include
works but I need time on time via Ajax
to always have the variable updated.
Be more specific in your question. You are passing which variable to where? You could put the code of "contalog.php" in the body of the question?
– Wallace Maxters
Paul, consider clicking the "edit" button and adding this information to the question. Getting clearer, we can help you better. I’m pretty sure you’re gonna need a "long Polling"
– Wallace Maxters
@Wallace Maxters Feito !
– PauloMaia
@Wallace Maxters How Can I Solve ?
– PauloMaia
I answered your question, see if it helps :D
– Wallace Maxters