3
What do I have:
I created several buttons through PHP and to distinguish them I used the variable $botoes_criados
.
So I have the variable value $botoes_criados
in PHP that is passed to a button as follows:
echo("<li><a href='#' onclick='pagination($botoes_criados)'>$botoes_criados</a></li>");
Next I made a javascript to receive through the function pagination()
receives the variable $botoes_criados
through the parameter.
What I intend to do: I want to pass the value of this variable back to PHP so I know which button was clicked.
What I tried to do:
<script>
function pagination(botao)
{
alert(window.location.href );
var xhttp = new XMLHttpRequest();
xhttp.open("GET", window.location.href, true);
xhttp.send("b=".botao);
}
</script>
In PHP I have the following code to try to receive the variable value
Echo($_GET['b']);
In short: All I want to do is make an Xmlhttprequest for the page itself so that I can collect the information of this variable. If you don’t understand my question comment I edit.