OT. Problema para todos los que ocupan AJAX

Armando Maldonado G. amaldonado en dportales.cl
Lun Mar 6 21:27:57 CLST 2006


Tengo un problema mas menos serio resulta que estoy desarrollando una 
aplicación intranet, ocupo javascript, el problema es que cuando ejecuto 
alguna función que tarde mucho en su ejecución (osea que llene mas menos 
unos 150 controles) en firefox me sale una advertencia que me dice 
Detener Script o Continuar, esa simple adventencia me tiene en problemas 
por que inmaginate que le salga eso a una secretaria, no va tener idea 
que hacer, sobre caching javascript ya lo probé aunque haga caching 
igual tendré que crear funciones que se demorarán más algún día, si 
alguién sabe algo como solucionar este problema, adémas es un problema 
para todos los que ocupan AJAX.

acuerdense que antes en lenguajes antiguos llenavamos listas gigantescas 
de 3000 lineas y ningún problema...


mando script que le echen una miradita..

if (isset($_POST['op'])) {
    header('Content-Type: text/plain; charset=UTF-8');
    $varSer = $serializador->newPacket();

    switch ( $_POST['op'] )
    {
		case	$_POST['op']=='buscar_productos':
			$bien_servicio_lista=bien_servicio_lista(1,0, $_POST['id_mbi']);
			$serializador->addVars($varSer,"bien_servicio_lista",$bien_servicio_lista);
			break;
    }
    echo $serializador->endPacket($varSer);
    exit();
}
///<-- BLOQUE DE ACCIONES A LA DB (1)/

include SISTEMA_PATH.'/encabezado.php'; ///Abre interfase web/
*?>*
/<!--BLOQUE JAVASCRIPT (2)-->/
*<script* language="javascript"*>*

*function* buscar_productos() {
	*var* url = '*<?php* echo SISTEMA_URL."/modulos/comercial/";*?>*ejemplo_patricio.php';
	top.js.ref_datos (document,{url:url,parameters:{op:'buscar_productos',id_mbi:1},callBackFunction:mostrar_productos});
}

*function* mostrar_productos(datos) {
	*var* items_b=document.getElementById('items_b').value;
	*var* j=0;
	*if* (datos["bien_servicio_lista"] && !top.js.empty(datos["bien_servicio_lista"])) {
		*for* (t=1;t<5;t++) {
		*for* (*var* i *in* datos["bien_servicio_lista"]) {
			*do* {
				j=j+1;
				*if* (j>items_b) {
					top.js.tableInsertRow(document, 'detalle_b', 'b0', 'items_b', *true*, -1 );
				}
			} *while* (!document.getElementById('id_bie_'+j))
			document.getElementById('id_bie_'+j).value = j;
			document.getElementById('nombre_bie_'+j).value = datos["bien_servicio_lista"][i]['nombre_bie'];
		}
		}
	} *else* {
		alert('arreglo vacio');
	}
	limpiar_productos(j+1,items_b);
}

*function* limpiar_productos(ini,fin) {
	*for* (i=ini; i<=fin; i++) {
		*if* (document.getElementById('id_bie_'+i)) {
			document.getElementById('id_bie_'+i).value = '';
			document.getElementById('nombre_bie_'+i).value = '';
		}
	}
}

*</script>*
/<!--BLOQUE HTML (3)-->/

*<form* name="formulario1" *>*

*<input* type="button" name="bbuscar_productos" id="bbuscar_productos" value="Buscar Productos" onClick="buscar_productos();"*>*

*<table* width="100%" border="0" cellpadding="2" cellspacing="0"*>*
*<tr* height="11px"*>*
	*<th* align="center" colspan="5" class="th2"*>*Produtos*</th>*
*</tr>*
*<tr* align="center"*>*
	*<td* class="th2" width="25%"*><b>*id_bie*</b></td>*
	*<td* class="th2" width="34%"*><b>*nombre_bie*</b></td>*
	*<td* class="th2" width="5%"*><b>*Eli*</b></td>*
*</tr>*
*<tr>*
	*<td* colspan="5"*>*
		*<input* type="hidden" name="items_b" id="items_b" value="0"*>*
		*<table* width="100%" border="1" cellpadding="0" cellspacing="0"*>*
		*<tr>*
		    *<td* width="100%" height="168px" align="center"*>*
			*<div* class="bloque_scroll"*>*
			*<table* width="99%" border="1" cellpadding="1" cellspacing="0" align="center"*>*
			*<tbody* id="detalle_b"*>*
			*<tr* class="*<?php* echo tabla_estilo();*?>*" align="center" id="b0"*>*
				*<td* width="25%" nowrap*>*
					*<input* type="text" name="id_bie_0" id="id_bie_0" size="15" onblur="javascript: this.value = this.value.toUpperCase();buscar_bien_accesorio(this.value,4+' '+3,this.parentNode.parentNode.id);"*>*
				*</td>*
				*<td* width="35%" nowrap*>*
					*<input* type="text" name="nombre_bie_0" id="nombre_bie_0" maxlength="200" size="25" *>*
				*</td>*
				*<td* width="5%" nowrap*>*
					*<img* src="*<?php* echo icono("actions/button_cancel.png");*?>*" width="13" title="Doble Click para Eliminar el Item" ondblclick="javascript: document.getElementById('detalle_b').deleteRow(this.parentNode.parentNode.rowIndex);"*>*
				*</td>*
			*</tr>*
			*</tbody>*
			*</table>*
			*</div>*
		    *</td>*
		*</tr>*
		*</table>*
		*<script* language="JavaScript"*>*document.getElementById("b0").style.display = 'none';*</script>*
		*<div* align="right"*>*
		*<button* type="button" onClick="top.js.tableInsertRow(document, 'detalle_b', 'b0', 'items_a', true, -1 );"*>*Nuevo Item*<img* src="*<?php* echo icono("actions/wizard.png");*?>*" *></button>*
		*</div>*
	*</td>*
*</tr>*
*</table>*

*</form>*


-- 
_____________________________________________________
Armando Maldonado Gómez
Mails: amaldonado en dportales.cl, amaldonado en ursm.cl
MSN: armando_maipu en hotmail.com
Movil: 91240070
Ingeniero de soporte de Organización Educacional Diego Portales
Teléfono 56-41-910252 Anexo 225 * Fax 56-41-910252 Anexo 224
Ingeniero de soporte de Universidad Regional San Marcos
Teléfono 56-41-917804
Asesor Informático de Autofrance Ltda.
Teléfono 56-41-405216
Representante Legal Treikkystem
Teléfono/FAX 997200
User # 245202 counter.li.org
Concepción - Chile.



Más información sobre la lista de distribución Linux