Ver Mensaje Individual
  #6 (permalink)  
Antiguo 18/03/2014, 02:34
Avatar de satjaen
satjaen
 
Fecha de Ingreso: septiembre-2012
Ubicación: Jaén (Andalucía)
Mensajes: 893
Antigüedad: 11 años, 8 meses
Puntos: 10
Respuesta: Mandar un form en un alert.

He pensado hacerlo con Jquery pero claro ya me tendría que cambiar de foro verdad ? Si alguien es tan amable de cambiarme a jQuery se lo agradecería.

Código Javascript:
Ver original
  1. mysql_select_db($database_conexion, $conexion);
  2. $query_Recordset2 = "SELECT * FROM almacen000 WHERE recambio='$recambio'";
  3. $Recordset2= mysql_query($query_Recordset2, $conexion) or die(mysql_error());
  4. $row_Recordset2 = mysql_fetch_assoc($Recordset2);
  5. $totalRows_Recordset2 = mysql_num_rows($Recordset2);
  6. $minimos = $row_Recordset2['minimos'];
  7. $existencias = $row_Recordset2['existencias'];
  8.  
  9. if($minimos == '1' and $existencias == '0') {
  10.  
  11.  
  12. echo "<script language='JavaScript'>
  13.  
  14.  
  15. respuesta =confirm('¿Atención, articulo en mínimos desea pedirlo?');
  16.    
  17.                    if (respuesta){
  18.                        
  19.                
  20.         $(document).ready(function() {
  21.    
  22.      $('#form4').trigger('submit');
  23.    
  24.    $('#form4').submit(function(event) {
  25.     var datos = $(this).serialize();  
  26.      event.preventDefault()
  27.      $.ajax(
  28.        {
  29.            url:'ins_minimos.php',
  30.            type:'POST',
  31.            data:datos,
  32.            beforeSend:function(objeto){
  33.                $('#carga').css({display:'block'});
  34.            },
  35.            complete:function(){
  36.                 $('#carga').css('display','none');
  37.                 },
  38.             success: function(data) {
  39.                $('#result').html(data);
  40.  
  41.            }
  42.        });
  43.    });
  44. });
  45.  
  46.            
  47.    
  48.                 }else{
  49.                      
  50.            
  51.                
  52.         }
  53.          
  54. </script>";
  55.  
  56.  
  57. }else{
  58.    
  59.    
  60.    
  61.     return false;
  62.    
  63.    
  64. }
  65. }
  66.  
  67.   }
  68. }
  69.  
  70. ?>
  71.  
  72.      <form action="<?php echo $editFormAction; ?>" method="post" name="form4" id="form4">
  73.                
  74.                <input type="hidden" name="id_aviso" id="id_aviso" value="STOCK EN MINIMOS" />
  75.                                
  76.                            <input type="hidden" name="recambio" value="<?php echo $row_Recordset2['recambio']; ?>" />
  77.                            
  78.                            
  79.                <input name="denominacion" id="denominacion" type="hidden" style="text-transform:uppercase;width:92%"
  80.                                  value="<?php echo $row_Recordset2['denominacion']; ?>" maxlength="40"/>
  81.                                  
  82.              <input name="cantidad" id="cantidad" type="hidden" value="<?php echo $row_Recordset2['minimos']; ?>" style="width:60px"/>        
  83.              <input name="pvp"   id="pvp" type="hidden" value="<?php echo $row_Recordset2['pvp']; ?>" style="width:60px"/>
  84.              
  85.                         <input type="hidden" name="MM_insert" value="form4" />
  86.                  
  87.               </form>