Foros del Web » Programando para Internet » Javascript » Frameworks JS »

Problemas con $.post no recorre el serialize

Estas en el tema de Problemas con $.post no recorre el serialize en el foro de Frameworks JS en Foros del Web. Tengo un pequeño problema y es que el post no me esta recogiendo los datos del formulario con el serialize. revisado con el firebugy no ...
  #1 (permalink)  
Antiguo 18/05/2011, 08:17
Avatar de ApipeMc  
Fecha de Ingreso: septiembre-2010
Ubicación: Medellín, Antioquia, Colombia
Mensajes: 76
Antigüedad: 13 años, 6 meses
Puntos: 1
Problemas con $.post no recorre el serialize

Tengo un pequeño problema y es que el post no me esta recogiendo los datos del formulario con el serialize.
revisado con el firebugy no encontrado el error.

Código PHP:
<?php
include ("../../script/conexion.php");
$cn conectar();

$materiaid $_GET['m'];

date_default_timezone_set("America/Bogota");
$anio date("Y");

$sql_materia mysqli_query($cn"SELECT Nombre,Apodo,Estado FROM materia WHERE MateriaId=$materiaid");
while(
$row mysqli_fetch_assoc($sql_materia)):
    
$Nombre $row[Nombre];
    
$Apodo $row[Apodo];
    
$Estado $row[Estado];
endwhile;
?>
<fieldset><legend>Modificacion Materia: <?php echo $Nombre?></legend>
<from id="form" name="form" method="post">    
    
<br/>    
<table class='ui-widget ui-widget-content'>
<thead>
    <tr class='ui-widget-header'>
        <th>Nombre</th>
        <th>Apodo</th>
        <th>Estado</th>
    </tr>
</thead>
<tbody>
    <tr>
        <td><input type="text" name="nombre" id="nombre_m" value="<?php echo $Nombre?>"/></td>
        <td><input type="text" name="apodo"  id="apodo" value="<?php echo $Apodo?>"/></td>
        <td><?php
            
if($Estado == "0"):
            echo 
"<input type='radio' name='estado' id='estado' value='0' checked>Activo<br/>
                  <input type='radio' name='estado' id='estado' value='1' >No Activo"
;
            else:
            echo 
"<input type='radio' name='estado' id='estado' value='0' >Activo<br/>
                  <input type='radio' name='estado' id='estado' value='1' checked>No Activo"
;
            endif;
            
?>
        </td>
    </tr>   
</tbody>
</table>
    
    <br/>    
    <strong>Integrar:</strong>
    <br/>
    <div id="accordion_modificar" style="width:100%;">
       <h3><a href="#">Eliminar</a></h3>
       <div>
       <?php
    $sql_relaciones 
mysqli_query($cn"SELECT Id, curso.Nombre AS CursoNombre,
                                                area.Nombre AS AreaNombre,
                                                materia.Nombre AS MateriaNombre,
                                                areaxmateriaxcurso.Porcentaje,areaxmateriaxcurso.Estado
                                         FROM areaxmateriaxcurso
                                            INNER JOIN curso   ON curso.CursoId     = areaxmateriaxcurso.CursoId
                                            INNER JOIN area   ON area.AreaId       = areaxmateriaxcurso.AreaId
                                            INNER JOIN materia ON materia.MateriaId = areaxmateriaxcurso.MateriaId
                                         WHERE
                                         areaxmateriaxcurso.MateriaId = $materiaid AND
                                         areaxmateriaxcurso.Anio = $anio"
);
    echo 
"
   <table class='ui-widget ui-widget-content'>
   <thead>
    <tr class='ui-widget-header'>
        <th>Curso</th>
        <th>Area</th>
        <th>Materia</th>
        <th>Porcentaje</th>
        <th>Estado</th>
        <th>Operación</th>
    </tr>
   </thead>
   <tbody>"
;
    while(
$row_rep mysqli_fetch_assoc($sql_relaciones)):
        echo 
"<tr>
              <td>$row_rep[CursoNombre]</td>
              <td>$row_rep[AreaNombre]</td>
              <td>$row_rep[MateriaNombre]</td>
              <td>$row_rep[Porcentaje]</td>"
;
        if(
$row_rep[Estado] == "0"):
            echo 
"<td> Activo </td>";
        else:
            echo 
"<td> No Activo </td>";
        endif;      
        echo 
"<td><a href='javascript:eliminar_datos($row_rep[Id]);'>Eliminar</a></td>
              </tr>"
;        
    endwhile;
   echo 
"
  </tbody>
  </table>"

    
?>    
</div>
       
       <h3><a href="#">Agregar</a></h3>
       <div>
       <table>
        <tr>
            <td style=" vertical-align:top;">
               Cantidad
                <select id="cantidad_modificacion" name="cantidad">
                    <option value="0"  >0 </option>
                    <option value="1"  >1 </option>
                    <option value="5"  >5 </option>
                    <option value="10" >10</option>
                    <option value="15" >15</option>
                    <option value="20" >20</option>
                </select>    
            </td>
            <td>
                <div id="relacion_modificar">
                    
                </div>
            </td>
        </tr>
       </table>                 
       </div>
    </div>   
<br/>
<input type='button' onclick='enviar_dato()' class='ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only ui-state-focus' role='button' value='Guardar'/>    
</from> 
    
</fieldset>
       
<script>
$(document).ready(function(){
    $("#cantidad_modificacion").change(function(event){
    cantidad = $("#cantidad_modificacion").find(':selected').val();
    $("#relacion_modificar").load('../control/admin/admon_materia_relacion.php?c='+cantidad, function(){
        $("#contener").load("blank.html");
      });
   });
});
function eliminar_datos(id){
    $(document).ready(function(){ 
        $('#dialog:ui-dialog').dialog('destroy');
        $('#guardar').dialog({
            height: 100,
            width: 200,
            resizable: false,
            modal: true,
            zIndex: 3999,
            open: function(event, ui) { 
            $(this).parent().children().children('.ui-dialog-titlebar-close').hide();
            }
        });
    });
    $.get('../control/admin/admon_materia_eliminar.php',{ Id: id },function(){ $('#guardar').dialog('close'); CM_Materia(); } );
}
function enviar_dato(){
    if($('#nombre_m').val() == ''){
        alert('Debe ingresar un nombre');
        return false;
    }
    $(document).ready(function(){
        $('#dialog:ui-dialog').dialog('destroy');
        $('#guardar').dialog({
            height: 100,
            width: 200,
            resizable: false,
            modal: true,
            zIndex: 3999,
            open: function(event, ui) { 
            $(this).parent().children().children('.ui-dialog-titlebar-close').hide();
            }
        });
    });
    $.post('../control/admin/admon_materia_modificar.php',$('#form').serialize(),function(){ $('#guardar').dialog('close'); CM_Materia(); } );
    return false;
}
    
$(document).ready(function()  {  
        var accOpts = {  
            alwaysOpen: false,
            active: false,
            animated : 'bounceslide',  
            autoHeight : false,  
            collapsible: true,  
            icons: { 'header': 'ui-icon-plus', 'headerSelected': 'ui-icon-minus' }  
        }  
        $('#accordion_modificar').accordion(accOpts);
    }); 
</script>
  #2 (permalink)  
Antiguo 21/05/2011, 07:03
Avatar de maycolalvarez
Colaborador
 
Fecha de Ingreso: julio-2008
Ubicación: Caracas
Mensajes: 12.120
Antigüedad: 15 años, 8 meses
Puntos: 1532
Respuesta: Problemas con $.post no recorre el serialize

la única manera que falle es que exista una etiqueta rota dentro del form
__________________
¡Por favor!: usa el highlight para mostrar código
El que busca, encuentra...

Etiquetas: jquery, phph
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 05:32.