reuben.m-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2009-Jul-31 22:43 UTC
Triggering Javascript after AJAX
I have a page starting out with: <div id="ajaxTarget"> </div> After an AJAX call, the innerhtml is updated to: <div id="ajaxTarget"> <div id="newDiv" /> <div> where after the new content is loaded, I want to run $(''newDiv'').fade({ duration: 2.0, from: 1, to: 0 }); I can''t figure out how to set this up. Code examples or links to documentation would be nice... :)
see this creencast: http://railscasts.com/episodes/136-jquery there ryan Bates shows how to use javascript after an ajax call and more. maybe it could help you. On 31 jul, 16:43, "reube...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <reube...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I have a page starting out with: > > <div id="ajaxTarget"> > </div> > > After an AJAX call, the innerhtml is updated to: > > <div id="ajaxTarget"> > <div id="newDiv" /> > <div> > > where after the new content is loaded, I want to run > > $(''newDiv'').fade({ duration: 2.0, from: 1, to: 0 }); > > I can''t figure out how to set this up. Code examples or links to > documentation would be nice... :)
reuben.m-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2009-Aug-01 02:32 UTC
Re: Triggering Javascript after AJAX
I''m an idiot. A simple :onsuccess callback was all I needed. But, on the upside, at the same time I figured out how insert javascript to be run after a "fake ajax file upload by redirect to iframe hack". On Jul 31, 5:43 pm, "reube...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <reube...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I have a page starting out with: > > <div id="ajaxTarget"> > </div> > > After an AJAX call, the innerhtml is updated to: > > <div id="ajaxTarget"> > <div id="newDiv" /> > <div> > > where after the new content is loaded, I want to run > > $(''newDiv'').fade({ duration: 2.0, from: 1, to: 0 }); > > I can''t figure out how to set this up. Code examples or links to > documentation would be nice... :)