Comunidad de diseño web y desarrollo en internet online

Ayuda con Prototype

Citar            
MensajeEscrito el 08 Ago 2007 04:40 pm
Estoy intentando hace un autocompleta con la clase prototype, pero me encontre con una incognita.
Puedo hacer que me devuelva la variable id cuando se a tenido exito el onComplete:

Osea algo haci, pero a mi no me funciona

Código :

function carga{
ajax = New Ajax{url,
           onComplete:onload(req,id)
           onErr:alert(error)}
}

function onload(req,id){}

Por york3rs

Claber

561 de clabLevel

1 tutorial

Genero:Masculino  

LA___Chile

msie
Citar            
MensajeEscrito el 08 Ago 2007 09:29 pm
Tengo este codigo:

Código :

id="contenedor";
new Ajax.Request('carga.php', 
{ 
method:'get', 
parameters: {dato: datos}, 
onSuccess: function(req,id){ alert(req+id) } 
onFailure: function(){ alert('Something went wrong...') } 
});

}


Necesito pasar los datos de id a la funcion :S

Por york3rs

Claber

561 de clabLevel

1 tutorial

Genero:Masculino  

LA___Chile

msie
Citar            
MensajeEscrito el 08 Ago 2007 09:45 pm
Escribo mi propia respuesta, luego de miles de pruebas.-

Código :

new Ajax.Request('carga.php', 
{ 
method:'get', 
parameters: {dato: 'example'}, 
onSuccess: function(req){ onCompl(id,req);}, 
onFailure: function(){ alert('Something went wrong...') } 
});
}


function onCompl(id,req){}

Por york3rs

Claber

561 de clabLevel

1 tutorial

Genero:Masculino  

LA___Chile

msie
Citar            
MensajeEscrito el 08 Ago 2007 11:50 pm
No entendi nada de lo que querias hacer.

Por NEO_JP

BOFH

5724 de clabLevel

13 tutoriales
12 articulos

Genero:Masculino   Anime Bloggers Premio_Secretos Team Cristalab

Front-end Developer en Washington, DC

firefox
Citar            
MensajeEscrito el 09 Ago 2007 01:35 pm
Queria pasa la variable id a la funcion onCompl(); desde la funcion que crea el objeto Ajax.-
Ej:

Código :

funcion ondata(id){
new Ajax.Request('carga.php', 
{ 
method:'get', 
parameters: {dato: 'example'}, 
onSuccess: function(req){ onCompl(id,req);}, 
onFailure: function(){ alert('Something went wrong...') } 
});
}
}
function onCompl(id,req){
alert(id);}


ondata(id) => onCompl(id,req)
id = id

Por york3rs

Claber

561 de clabLevel

1 tutorial

Genero:Masculino  

LA___Chile

msie
Citar            
MensajeEscrito el 10 Ago 2007 01:18 am
Después de haber leido varias veces el post ya entendí, primero intenta si la variable id si está llegando hasta ese lugar, junto al req.

Cambia el:

Código :

function(req){ onCompl(id,req);},


Por:

Código :

function(req){ alert(id,req);},


Cuentanos si funciona.

Por NEO_JP

BOFH

5724 de clabLevel

13 tutoriales
12 articulos

Genero:Masculino   Anime Bloggers Premio_Secretos Team Cristalab

Front-end Developer en Washington, DC

safari

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.