AJAX request loads a new element - new element without eventhandler
Hi,
If I generate a new element via AJAX, jQuery don't listen to events at this element.
I read that live() could solve my problem, but I have no idea how to use this function together with post().
That's what I have:
- $(document).ready(function() {
- $.post('products.php', $('#products_form').serialize(), function(returnData) {
$('.target').html(returnData);
- });
- $('.target').click(function() {
- alert('x');
- });
- });
Any ideas?
Cheers, Alex