Ver Mensaje Individual
  #5 (permalink)  
Antiguo 20/09/2012, 17:20
gordot
 
Fecha de Ingreso: febrero-2010
Ubicación: cba
Mensajes: 203
Antigüedad: 15 años, 1 mes
Puntos: 16
Respuesta: cambiar variable de consulta sql con javascript

Gracias por tu respuesta. hice lo siguiente y no me funciono.

<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />




<script>
$('#diego').change(function(){
var data = "idSub="+id2;
$.ajax({
method:"post",
url:"procesa_archivo.php",
data:data,
success:function(html){
$("#div_info").html(html);
}, error: function(){
alert("error");
}
});
});
</script>

<style type="text/css">
#div_info{
color:white;

}
</style>
</head>
<body>

<select name="diego" onchange="cargar_pagina('procesa_archivo.php','div _info',this.value)">
<option value="1">opcion1</option>
<option value="2">opcion2</option>

<div id="div_info"></div>

</select>
</body>
</html>

procesa_archivo.php

<?php
include("conectar.php");
//se recoge la variable que se envia
$idSub = $_POST['idSub'];
$sql = "SELECT * FROM usuarios WHERE idTabla = $idSub";


$RESULTADO=mysql_query($sql);


while($FILA=mysql_fetch_array($RESULTADO))
{
echo $FILA[id];

}

?>