Tenho uma consulta q lista todos as informações do banco, nela tenho um input para o usuário digitar algo e fazer a listagem pelas iniciais q ele digitou.
No php puro seria simples, só era pagar via $_POST o que foi digitado. Como o jquery no meu sistema para abrir as páginas secundárias dentro index.php sem dar refresh, isso simplimente não funciona, então coloquei um função para fazer isso, só q ñ estou conseguindo pegar o retorno da função para testar no php, vou colocar os códigos, talvez seja mais fácil de entender assim:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
@import url('css/estilos1.css');
</style>
<script type="text/javascript">
$(function(valor) {
$("#lista_laboratorial").submit(function() {
var nome_exame = $("#nome_exame").val();
$("#status").html("<img src='admin/imagens/ajax-loader.gif'/>\nPesquisando...");
$.post('teste1.php', {nome_exame: nome_exame}, function(resposta) {
$("#status").slideDown();
if (resposta != false) {
$("#status").load("teste1.php",{paramentro:valor})
}
else {
$("#nome_exame").val("");
}
});
});
});
</script>
</head>
<body>
<form action="javascript:func()" name="lita_laboratorial" id="lista_laboratorial" method="">
<div id="status"></div>
<table width="100%" border="0">
<td colspan="4">Digite o nome de um exame para consultar :<input name="nome_exame" type="text" id="nome_exame" size="40" maxlength="40" /><input type="submit" name="consulta_exame" id="consulta_exame" value="Ok" />
<td colspan="3" align="right"><div><a href="#" url="frm_rlaboratorial.php"><img src="admin/imagens/inserir.gif" alt="" width="80" height="30" border="0" /></a></div></td>
<tr>
<td width="48%" align="center" class="tarja">Exames</td>
<td width="26%" align="center" class="tarja">Categorias</td>
<td width="11%" align="center" class="tarja">Data</td>
<td align="center" colspan="2" class="tarja">Ação</td>
</tr>
</td>
</table>
<table width="100%" border="0">
<?php
// SE FOR DIGITADO ALGO NO INPUT, A FUNÇÃO JQUERY É ESTARTADA E EU QUERO PEGAR SEU RESULTADO AKI
if (retorno do jquery verdadeiro) {
// CONDIÇÃO
} else
{
// CONDIÇÃO
}
<div id='status'></div>
TESTE1.PHP
<?php
$nome_exame = $_POST['nome_exame'];
if (!empty($nome_exame)){
$nome = 'true';
}
else
{
$nome = 'false';
}
?>
Alguém poderia me ajudar a concluir esse código ?
- BobbyCak likes this



Postagens
Male
