You could use the LiveQuery plugin or the Listen plugin (both at http://plugins.jquery.com/) or handle it yourself. One way to handle this is to use event delegation. See this blog entry for details:

http://www.learningjquery.com/2008/03/working-with-events-part-1


--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com



On Apr 9, 2008, at 1:40 AM, franco57 wrote:


Hi, I have this question

have data coming from DB and put dynamicaly in a page through a while
cycle (php). How can I bind an event click to  the generate html tag
(eg:<a id="link_agenzie" href="cerca2.php?cosa=<? echo
$cod['status']; ?>&agenzia=<? echo $cod['agenzia']; ?>" style="text-
decoration:none;">SOLO</a>)

I have this code

<script type="text/javascript">
$(document).ready(function(){
   $("#link_agenzie").click(function(){
         var params = $(this).attr("href");
         params  = params.split("?");
         $('#loading').html('<div id="loading">Caricamento in
corso ...</div>');
         $.ajax({
             url: ""+params[0]+"",
             data: ""+params[1]+"&"+params[2]+"",
             success: function(html){
             $("#wrapper").append(html);}
         });
       });
});
</script>

but only the first link is working, not the subsequent

please help
franco

Reply via email to