views:

34

answers:

1

Is there a way I can load content dynamically using ajax and retain any jquery functionality that the loaded content may have?

For example, I'd like to load in a Twitter like feed of DB records. Each record can be voted thumbs up or thumbs down. The voting uses some AJAX and I can't retain event functionality when loaded into a parent page.

ok forgive such a noob question but I'm lost with the example on the jquery page. When it says:

$('a').click(fn); 
$('#mydiv').load('my.html',function(){ 
$('a').click(fn); });

what is fn supposed to represent?

+5  A: 

Use event delegation, .live() or .delegate() will do the trick. It has a lot more advantages than just retaining functionality too.

John Strickler
thanks John, .live() worked like a charm!
RyGuy