Abraços Walker

Posted 02/04/2008, 23:13
Posted 03/04/2008, 08:43
Posted 03/04/2008, 11:20
Edição feita por: willwalker, 03/04/2008, 11:35.
Posted 03/04/2008, 13:11
Posted 04/04/2008, 02:15
<p><?php
if( $_SESSION['nivel'] == "adm" ){
$sQuery = "SELECT * FROM chamados ORDER BY codigo DESC";
$oPessoa = mysql_query($sQuery);
}else{
$sQuery = "SELECT * FROM chamados WHERE acessor='".$_SESSION['nom_usuario']."' ORDER BY codigo DESC";
$oPessoa = mysql_query($sQuery);
}
?>Tramitação<br>
<select name="tramita" id="tramita">
<option value="na"></option><?php
while( $rs = mysql_fetch_array($oPessoa) )
{
$nome_print = $rs["id"];
echo "<option value='$nome_print'>$nome_print</option>";
}
?>
</select></p>
<div id="resultado"></div>
<script type="text/javascript">
function ajaxInit() {
var xmlhttp;
//verifica se o browser tem suporte a ajax
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e) {
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch(ex) {
try {
xmlhttp = new XMLHttpRequest();
}
catch(exc) {
alert("Esse browser não tem recursos para uso do Ajax. Por favor atualize seu Navegador!");
xmlhttp = null;
}
}
}
return xmlhttp;
}
function LoadAjax(obj) {
ajax = ajaxInit();
if (ajax) {
ajax.onreadystatechange = function () {
if(ajax.readyState == 1) {
document.getElementById(obj).innerHTML = 'Carregando...';
}
if(ajax.readyState == 4 ) {
if(ajax.responseText) {
processTEXT(ajax.responseText,obj);
}
else {
//caso não seja um arquivo XML emite a mensagem abaixo
document.getElementById(obj).innerHTML = "Erro ao carregar!";
}
}
}
ajax.open('GET', "config.php", true);
ajax.send(null);
}
}
function processTEXT(retorno) {
document.getElementById("resultado").innerHTML = retorno;
}
//function q chama o ajax
function Ajuda(obj) {
LoadAjax(obj);
}
</script>
Posted 04/04/2008, 08:50
Posted 04/04/2008, 10:44
Edição feita por: willwalker, 04/04/2008, 10:59.
Posted 04/04/2008, 10:58
<p><?php if( $_SESSION['nivel'] == "adm" ){ $sQuery = "SELECT * FROM chamados ORDER BY codigo DESC"; $oPessoa = mysql_query($sQuery); }else{ $sQuery = "SELECT * FROM chamados WHERE acessor='".$_SESSION['nom_usuario']."' ORDER BY codigo DESC"; $oPessoa = mysql_query($sQuery); } ?>Tramitação<br> <select name="tramita" id="tramita" onchange="Ajuda('resultado',this.value)"> <option value="na"></option><?php while( $rs = mysql_fetch_array($oPessoa) ) { $nome_print = $rs["id"]; echo "<option value='$nome_print'>$nome_print</option>"; } ?> </select></p> <div id="resultado"></div> <script type="text/javascript"> function ajaxInit() { var xmlhttp; //verifica se o browser tem suporte a ajax try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) { try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch(ex) { try { xmlhttp = new XMLHttpRequest(); } catch(exc) { alert("Esse browser não tem recursos para uso do Ajax. Por favor atualize seu Navegador!"); xmlhttp = null; } } } return xmlhttp; } function LoadAjax(obj, parametro) { ajax = ajaxInit(); if (ajax) { ajax.onreadystatechange = function () { if(ajax.readyState == 1) { document.getElementById(obj).innerHTML = 'Carregando...'; } if(ajax.readyState == 4 ) { if(ajax.responseText) { processTEXT(ajax.responseText,obj); } else { //caso não seja um arquivo XML emite a mensagem abaixo document.getElementById(obj).innerHTML = "Erro ao carregar!"; } } } ajax.open('GET', "config.php?q="+parametro, true); ajax.send(null); } } function processTEXT(retorno) { document.getElementById("resultado").innerHTML = retorno; } //function q chama o ajax function Ajuda(obj, parametro) { LoadAjax(obj, parametro); } </script>
$var = $_GET['q']; <? codigo php q faz a consulta echo $resposta; ?>
Posted 04/04/2008, 12:57
Edição feita por: willwalker, 04/04/2008, 12:58.
Posted 04/04/2008, 13:31
Posted 04/04/2008, 14:24
Edição feita por: willwalker, 04/04/2008, 14:25.
Posted 04/04/2008, 14:42
Posted 10/04/2008, 20:09
Posted 10/04/2008, 20:50
Posted 25/05/2008, 07:16
0 membro(s), 1 visitante(s) e 0 membros anônimo(s)