I would like to convert this code to jquery.
To say. Instead of appearing in the iframe, I would like it to be a single page normally, and the insertion would be without refresh.
$.post("resultado.php", function(result){
$("#id").val(result.id);
$("#nome").val(result.nome);
$("#idade").val(result.idade);
}
);
I had thought of $.get
/ post(function(resposta))
,
Only here returns only a single response and not the full result that I would like.
The result.php page:
<?
$mysqli = new mysqli("localhost", "usuario1", "senha1","banco1");
if($_GET[id]) {
$res_a = $mysqli->query("select id, nome, idade from usuarios where id='$_GET[id]'");
$res_b = $res_a->fetch_assoc();
$id = $res_b[id];
$nome = $res_b[nome];
$idade = $res_b[idade];
?>
<table>
<tr>
<td>ID</td><td><input value="<?=$id?>"></td></tr>
<td>NOME</td><td><input value="<?=$nome?>"></td></tr>
<td>IDADE</td><td><input value="<?=$idade?>"></td></tr>
</table>
<? exit; } ?>
<table width="100%">
<tr>
<td>
<table>
<?
$result = $mysqli->query("select id, nome from usuario");
while($row = $result->fetch_assoc()) {
?>
<tr>
<td><a href="?id=<?=$row[id]?>" target="frame"> <?=$row[id]?> </a></td>
<td><a href="?id=<?=$row[id]?>" target="frame"> <?=$row[nome]?> </a></td>
</tr>
<? } ?>
</table>
</td>
<td>
<iframe name="frame" />
</td>
</tr>
</table>