Ver Mensaje Individual
  #4 (permalink)  
Antiguo 03/09/2014, 15:35
Avatar de Alexis88
Alexis88
Philosopher
 
Fecha de Ingreso: noviembre-2011
Ubicación: Tacna, Perú
Mensajes: 5.552
Antigüedad: 13 años, 4 meses
Puntos: 977
Respuesta: Reporte con filtros

¿Y si a la función le pasas el nombre de la variable que quieres que vaya?

Código HTML:
Ver original
  1. <select name="tipo" onchange="mostrarInfo('cod_banda', this.value)">
  2.     <!-- Opciones -->
  3.  
  4. <select name="tipo2" onchange="mostrarInfo('cod_banda2', this.value)">
  5.     <!-- Opciones -->

Código Javascript:
Ver original
  1. function mostrarInfo(variable, cod){
  2.     if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
  3.         xmlhttp = new XMLHttpRequest();
  4.     }
  5.     else{// code for IE6, IE5
  6.         xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  7.     }
  8.  
  9.     xmlhttp.onreadystatechange = function(){
  10.         if (xmlhttp.readyState == 4 && xmlhttp.status == 200){
  11.             document.getElementById("datos").innerHTML = xmlhttp.responseText;
  12.         }else{
  13.             document.getElementById("datos").innerHTML = 'Cargando...';
  14.         }
  15.     };
  16.  
  17.     xmlhttp.open("POST", "conexion/cons_report.php", true);
  18.     xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  19.     xmlhttp.send(variable + "=" + cod);
  20. }

Por eso te decía que podías pasar más parámetros para personalizar el resultado.

Saludos
__________________
«Juro por mi vida y mi amor por ella, que jamás viviré para el provecho de otro hombre, ni le pediré a otro hombre que viva para el mío».

Ayn Rand