Ver Mensaje Individual
  #1 (permalink)  
Antiguo 21/01/2014, 09:04
Avatar de kakashi20
kakashi20
 
Fecha de Ingreso: septiembre-2009
Mensajes: 616
Antigüedad: 14 años, 7 meses
Puntos: 15
Exclamación busqueda me cuelga la conexion de la pagina

hola

tengo esta búsqueda de info de mysql por medio de ajax.

El problema es que al hacer esta búsqueda de manera exhaustiva, osea, cuando estoy buscando muchos productos y escribiendo muchos nombre, la conexión de la pagina se cuelga y aparece en el navegador google chrome que se ha perdido la conexión con la pagina.

no se porque pasa esto.

si alguien me pudiese ayudar se lo agradeceria.

Form Búsqueda:

Código HTML:
Ver original
  1. <table border='0' width='348px'>
  2.             <tr height="50px">
  3.                 <td colspan='2' align='center' style="font-size:14px; font-weight:bold">Busqueda Productos</td>
  4.             </tr>
  5.            
  6.             <tr>
  7.                 <td width='50%' align="right">Nombre:</td>
  8.                 <td>
  9.                    <input type="text" name="nom" id="nom" onkeyup="BuscarProducto()" />
  10.                 </td>
  11.             </tr>
  12.        
  13.            
  14.            
  15.            
  16.            
  17.            
  18.            
  19.                
  20.         </table>
  21.        
  22.          
  23.     </form>
  24.  
  25. <div id="result" style="border:0px solid #F00; width:1000px"></div>


Ajax:


Código Javascript:
Ver original
  1. function BuscarProducto(){
  2.  
  3.    
  4.  
  5.  
  6.  
  7.     nom= $("#nom").val() ;
  8.  
  9.    
  10.  
  11.     str = "nom="+nom;
  12.  
  13.    
  14.  
  15.    
  16.  
  17.    
  18.  
  19.     $.ajax({
  20.  
  21.    
  22.  
  23.                
  24.  
  25.                
  26.  
  27.                 type: 'POST',
  28.  
  29.    
  30.  
  31.                 url: 'ListadoProductos2.php',
  32.  
  33.                
  34.  
  35.                 data: str,
  36.  
  37.    
  38.  
  39.                 success:function(msg){
  40.  
  41.    
  42.  
  43.                    
  44.  
  45.                            
  46.  
  47.                                
  48.  
  49.                                 $("#result").html(msg)
  50.  
  51.                            
  52.  
  53.                        
  54.  
  55.                        
  56.  
  57.    
  58.  
  59.                 }
  60.  
  61.    
  62.  
  63.                
  64.  
  65.    
  66.  
  67.     });
  68.  
  69.    
  70.  
  71.    
  72.  
  73.    
  74.  
  75.                        
  76.  
  77.    
  78.  
  79. }


pagina ListadoProductos2.php:

Código PHP:
Ver original
  1. <?
  2. include ('lib/claseBaseDatos.php');
  3.     $conexion = new ConexionBaseDatos;
  4.     $link = $conexion->Conectarse($conexion);
  5.    
  6.    
  7. ?> 
  8.  
  9. <style type="text/css">
  10. .fila_0 { background-color: #3C80EE; color:#fff}
  11. .fila_1 { background-color: #FFF;}
  12.  
  13.  
  14.  
  15.  
  16. </style>
  17.  
  18. <form>
  19.         <table border='0' width='348px'>
  20.             <tr height="50px">
  21.                 <td colspan='2' align='center' style="font-size:14px; font-weight:bold">Busqueda Productos</td>
  22.             </tr>
  23.            
  24.             <tr>
  25.                 <td width='50%' align="right">Nombre:</td>
  26.                 <td>
  27.                    <input type="text" name="nom" id="nom" onkeyup="BuscarProducto()" />
  28.                 </td>
  29.             </tr>
  30.            
  31.             <tr height="50px">
  32.                 <td colspan='2' align='center' style="font-size:12px; font-weight:bold">Rango de Precios de Ventas</td>
  33.             </tr>
  34.            
  35.             <tr>
  36.                
  37.                 <td colspan="2" align="center">
  38.                   Precio Menor: <input type="text" name="p1" id="p1" style="width:70px"  /> Precio Mayor:<input type="text" name="p2" id="p2" style="width:70px"  />
  39.                 </td>
  40.             </tr>
  41.            
  42.            
  43.            
  44.            
  45.             <tr>
  46.                
  47.                 <td colspan="2" align="center">
  48.                    <input type="button" value="Buscar por precio" onclick="BuscarProducto2()" />
  49.                 </td>
  50.             </tr>
  51.            
  52.            
  53.                
  54.         </table>
  55.         <br />
  56.         <div id="result" style="border:0px solid #F00; width:1000px">
  57.        
  58.         <table border='0' width="100%">
  59.             <tr>
  60.                 <td colspan='9' align='center' style="font-size:14px; font-weight:bold">Listado de productos</td>
  61.             </tr>
  62.  
  63.             <tr>
  64.            
  65.                 <td style="font-weight:bold">Producto</td>
  66.                 <td style="font-weight:bold">Precio Costo</td>
  67.                 <td style="font-weight:bold">Precio Venta</td>
  68.                 <td style="font-weight:bold">Cantidad</td>
  69.                 <td style="font-weight:bold">Garant&iacute;a</td>
  70.                 <td style="font-weight:bold">Fecha Ingreso</td>
  71.                 <td style="font-weight:bold">Descripci&oacute;n</td>
  72.                 <td style="font-weight:bold"></td>
  73.             </tr>
  74. <?
  75.             $query = mysql_query("select producto, precio_costo, precio_venta, cantidad, garantia, fecha_ingreso, descripcion, id from productos order by producto");
  76.             $i=0;
  77.             while($row = mysql_fetch_assoc($query)){
  78.                 echo "<tr class='fila_".($i%2)."'>";
  79.                    
  80.                     echo "<td> $row[producto] </td> ";
  81.                     echo "<td> $row[precio_costo] </td> ";
  82.                     echo "<td> $row[precio_venta] </td> ";
  83.                     echo "<td> $row[cantidad] </td> ";
  84.                     echo "<td> $row[garantia] </td> ";
  85.                     echo "<td> $row[fecha_ingreso] </td> ";
  86.                     echo "<td> $row[descripcion] </td> ";
  87.                     echo "<td><img src='img/edit.png' style='cursor:pointer' title='Editar' onclick='EditarProducto(".$row['id'].")'></td>";
  88.                 echo '</tr>';
  89.                 $i++;
  90.             }
  91.            
  92.    
  93. ?>         
  94.         </table>
  95.        
  96.        
  97.         </div>
  98.          
  99.     </form>