1
Hello, The following code will present a table with values.I am recovering the cell value of the table that the user clicks through this function $(this).text()
in Java. I have to send this information by this function,by an ajax,to a page called (Tela_Escolha_Perguntas_correcao.php
) which 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 the table construction 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 the $_GET['nomeGrupo']
and did not succeed.
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script type="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 from the table cell to this second screen, and the tmb user is directed to this screen and can see the submitted content.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<body>
<div class="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>