$(this).text()
function in javaScript. I have to send this information get through this function, for an ajax, to a page that is called ( Tela_Escolha_Perguntas_correcao.php
) that is present in the same folder as the code below. In this ( Tela_Escolha_Perguntas_correcao.php
) screen I want to appear the value sent to it. Note that in constructing the table I am creating a link to ( Tela_Escolha_Perguntas_correcao.php
) for when the user clicks on it to be directed to it.
I tried to use $_GET['nomeGrupo']
and did not succeed.
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script><scripttype="text/javascript">
$(function () {
var valor;
var nomeGrupo;
$('.classGrupo').click(
function () {
nomeGrupo=$(this).text();
valor ={'nomeGrupo':nomeGrupo};
$.ajax(
{
type: 'GET',
url:'Tela_Escolha_Perguntas_correcao.php',
data: valor,
async: false
}
).done(function (retorno) {
alert(retorno);
});
}
);
});
</script>
</head>
<body>
<header>
<figure>
<img <img src="../imagens/logotipo.png">
</figure>
</div>
<div id="divBusca">
<input type="text" id="txtBusca" placeholder="Buscar..."/>
<button id="btnBusca">Buscar</button>
</div>
<div id="IDsair">
<a href="Sair_Sessao.php">SAIR</a>
</div>
</header>
<div id="id_tabela">
<table >
<tr>
<th>Grupos</th>
</tr>
<?php
for($i=0;$i<4;$i++){
echo " <tr>
<td class='classGrupo'><a href='Tela_Escolha_Perguntas_correcao.php'>valor,$i</a></td>
</tr>";
}
?>
</table>
</div>
Second Screen ( Tela_Escolha_Perguntas_correcao.php
) The first code sends the text of the table cell to this second screen, and the user tmb is directed to this screen and can see the contents sent.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script><body><divclass="principal">
<header>
<figure id="logo">
<img src="../imagens/logotipo.png">
</figure>
<span><h1><?php echo'',$_GET['nomeGrupo']; ?></h1></span>
<div id="logoUserADM">
<figure id="logoADM">
<img src="../imagens/administrador.png">
</figure>
<figure id="logoUser">
<img src="../imagens/imagemPerfilA.png">
</figure>
</div>
</header>
<section>
<label>Criar Perguntas</label>
<label>Corrigir Perguntas</label>
<div id="imagensBotoes">
<a href="jk"><img src="../imagens/CostrucaoAtividade.jpg"> </a>
<a href="jk"><img src="../imagens/Correcao.png"> </a>
<div>
</section>
</header>
</div>