jQuery
New Wave Javascript


discuss » dynamically loading html into a container and then....


Posted: Tue Jan 31 17:11:38 EST 2006
From: John Resig <jeresig at gmail.com >

Mark -

> Ok, now the problem is i'm loading in the LI's (and UL) from an AHAH
> request to a script into a "preview" DIV container, the problem seems
> to be that once the LI's are loaded externally they need to be
> "synced" with the page, or they don't seem to be able to have an event
> attached to them. Which is why I generated the onlclick events
> dynamically onto the LI elements in the script page (asp.net).

Do you have any examples of this? I've tried this in the past and
it's worked, so I'm not entirely sure what's going wrong.

> I'm having a similar problem with JAVASCRIPT in an external page call
> via AHAH not executing in the "host" page, i think the page needs to
> be re-initialised or something...

I know that the Ruby On Rails guys have the same problem, but they do
some crazy Javascript parsing to make it work (the look through the
incoming html for <script>...</script> tags, grab the Javascript, and
execute it dynamically). You'll want to search around for info on
script, prototype, and ruby on rails - for more info.

> I hope I'm making sense here. If its any consolation, I'll have a nice
> app to show off the simplicity of JQuery. A non "WEB 2.0" (sic) is at
> www.tunecast.co.uk

Nice! I'm looking forward to seeing it.

--John