Ver Mensaje Individual
  #8 (permalink)  
Antiguo 05/03/2009, 17:35
0le0
 
Fecha de Ingreso: octubre-2008
Mensajes: 109
Antigüedad: 15 años, 6 meses
Puntos: 0
Respuesta: Depurar código en divs

Este es el código en donde quiero ver que me aparece dentro del div..

Código:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin t&iacute;tulo</title>
<script language="javascript" type="text/javascript" src="ajax.js"></script>
</head>

<body>
<? if(!isset($_GET['entidad']) )
{
	$fE='todo';
}
else
$fE=$_GET['entidad'];
 

?>
<table align="center">
<form>
<tr>
	<td>Seleccionar entidad</td>
    <td><select id="entidad" name="entidad" size="1" onchange="ajaxFunction()">
    		<option value="todo"<? if ($fE=="todo") echo "selected=\"selected\""; ?>> Toda</option>
        <option value="01" <? if ($fE=="01") echo "selected=\"selected\""; ?> 
        <option value="31" <? if ($fE=="31") echo "selected=\"selected\""; ?> >Y</option>
        <option value="32" <? if ($fE=="32") echo "selected=\"selected\""; ?>>Z</option>
	</select> 
    
    </td>
    <td>Filtrar Programa</td>
    <td><select id="programa" name="programa" size="1">
    	<option value="0">Todo</option>
        <option value="1">CONAFE</option>
        <option value="2">MEE</option>
        <option value="3">INIFED</option>
    </select>
    </td>
</tr>

	<tr><td></td>
    <td>
yo quiero ver lo que se genera aquí al ver el código fuente , pero no me aparece
    <div id='ajaxDiv'></div>
</td>
</tr>
<tr><td><input type="submit" /></td></tr>
</form>
</table>
</body>
</html>
Este es el archivo ajax
Código:
// JavaScript Document
function ajaxFunction(){
	
	var ajaxRequest;  // magic variable
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	
	// Receive Data Function 
	ajaxRequest.onreadystatechange = function(){
		
		if(ajaxRequest.readyState == 4){
			var ajaxDisplay = document.getElementById('ajaxDiv');
			ajaxDisplay.innerHTML = ajaxRequest.responseText;
		}
		
	}
	
	var make = document.getElementById('entidad').value;
	
	var queryString = "?entidad=" + make;
	ajaxRequest.open("GET", "genMun.php" + queryString, true);
	ajaxRequest.send(null); 
}
Y este el archivo genMun
Código PHP:
<?php
require_once("../comun/conexion.php"); // database connection

    // Retrieve data from Query String
$make $_GET['entidad'];

    
//build query

$query "SELECT mun,nom_mun FROM inm WHERE entidad = '$make' group by nom_mun";
$result     = @mysql_query($query); 
$rowEstados     mysql_fetch_array($result);

/////////////////////////////////////////////////
if($make == 'todo')
echo 
"<td style=\"display:none\"></td>";

else
{
    
//Build Result String
$dropdown "<select name=\"municipio\">";
$dropdown .= "<option value=\"\">Seleccione Municipio</option>";


    
// Insert a new row in the table for each person returned
do {
    
$dropdown .= "<option value=".$rowEstados['municipio'].">".$rowEstados['nom_mun']."</option>";
    
}while (
$rowEstados mysql_fetch_array($result));

$dropdown .= "</select>";


echo 
$dropdown;
}
mysql_free_result($result);
require_once(
"../comun/cerrarbd.php");
?>

Otra cosa que vi es que si mando el formulario me aparecen todas las variables de mi formulario menos la de municipio que es la que se carga al seleccioanr un estado.
Esto funciona correctamente en ie7 pero en firefox no me pone el valor de municipio.
Se puede hacer algo??