AJAX - Tabla con datos de un select

 
Vista:

Tabla con datos de un select

Publicado por marcelo (1 intervención) el 06/01/2014 19:16:56
Hola a todos

estoy hacuiendo una tabla que tome datos de un select. tengo los siguientes codigos pero no me muestra ningun resultado


codigo de la funcion

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<script>
function InsertData(str)
{
if (str=="")
{
document.getElementById("txtHint").innerHTML="";
return;
}
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("txtHint").innerHTML=xmlht tp.responseText;
}
}
}
</script>
-------------------------------------------------------------------------------------------------

Codigo PHP

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
echo"<table width='990'>
<tr>
<th colspan='7'>TARJETAS DE CREDITO (En Desarrollo)</th>
</tr>
<tr>
<td width='150' class= 'subtit'>Cia Aerea</td>
<td width='150' class= 'subtit'>Tarjeta</td>
<td width='150' class= 'subtit'>Nro Comercio</td>
<td width='150' class= 'subtit' >Telefono</td>
<td width='130' class= 'subtit'>Tabla de Coeficientes</td>
<td width='130' class='subtit'>Calculador de Cuotas</td>
<td width='130' class='subtit'>Promociones sin Interes</td>
</tr>
<tr> 
<td rowspan ='5'> 
<select name='seltc' onchange='InsertData(this.value'>
<option value='0'>Selecione CIA</option>
<option value='JJ'>TAM - JJ</option>
<option value='PZ'>TAM MERCOSUR - PZ</option>
</select>
</td>
</tr>";
$q = intval($_GET['q']);
$sql = "SELECT DISTINCT nombre,comercio,telefono FROM coeficientes WHERE cia='".$q."' GROUP BY nombre ORDER BY nombre asc";
$res = mysqli_query($conn, $sql);
$row= mysqli_num_rows($res);
$ctr=$row;
while ($fila = mysqli_fetch_assoc($res)) {
echo"<tr>
<td id='txtHint'>".$fila['nombre']."</td>
<td id='txtHint'>".$fila['comercio']."</td>
<td id='txtHint'>".$fila['telefono']."</td>";


Desde ya muchas gracias por su colaboracion

Saludos y buen año para todos
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de xve
Val: 90
Oro
Ha mantenido su posición en AJAX (en relación al último mes)
Gráfica de AJAX

Tabla con datos de un select

Publicado por xve (222 intervenciones) el 06/01/2014 21:08:53
Hola Marcelo, no se si es este el problema, pero aquí tienes un error:
1
<select name='seltc' onchange='InsertData(this.value'>
te falta cerrar el paréntesis...

No se si es este el problema... nos puedes comentar?
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar