Hi. Im using a Ajax.Request to load some content to a div. I would like to trigger a function after the content has been loaded into the div, in order to resize the div to fit the new content. But, For now it seems to trigger my function before the content has been loaded. var opt = { // Handle successful response onSuccess: function(t) { $(''uBoxContent'').innerHTML = t.responseText; }, // Handle 404 on404: function(t) { alert(''Error 404: location "'' + t.statusText + ''" was not found.''); }, // Handle other errors onFailure: function(t) { alert(''Error '' + t.status + '' -- '' + t.statusText); } } new Ajax.Request(ContentUrl, opt); new uBox.Resize(); Is there any way, to trigger the uBox.Resize(); AFTER the content has been loaded into the uBoxContent div? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
jdalton
2008-Apr-22 13:17 UTC
Re: Trigger a function, after another function has completed.
On Apr 22, 2:47 am, revivedk <Timsoren...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi. Im using a Ajax.Request to load some content to a div. > I would like to trigger a function after the content has been loaded > into the div, in order to resize the div to fit the new content. > But, For now it seems to trigger my function before the content has > been loaded. > > var opt = { > // Handle successful response > onSuccess: function(t) { > $(''uBoxContent'').innerHTML = t.responseText; > }, > // Handle 404 > on404: function(t) { > alert(''Error 404: location "'' + t.statusText + ''" was not > found.''); > }, > // Handle other errors > onFailure: function(t) { > alert(''Error '' + t.status + '' -- '' + t.statusText); > } > } > > new Ajax.Request(ContentUrl, opt); > new uBox.Resize(); > > Is there any way, to trigger the uBox.Resize(); AFTER the content has > been loaded into the uBoxContent div?--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
jdalton
2008-Apr-22 13:19 UTC
Re: Trigger a function, after another function has completed.
I am not sure about the rest of the code but I would think this: onSuccess: function(t) { $(''uBoxContent'').update( t.responseText ); new uBox.Resize(); }, --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---