tags:

views:

32

answers:

1

Hello guys,

I have a function in jquery that looks like this.

    function interceptFilter(e){
  $.ajax({
  type: "POST",
  data: $('#formContent form').serialize(),
  url: "index.php?page=filter",
  timeout: '3000',
  error: function(XMLHttpRequest, textStatus, errorThrown){
   alert('Error loading HTML document: ' + textStatus + ' - ' +
    errorThrown);
  },
  success: function(data, textStatus){
   var dagFilter = $('#filterDag :selected').text();
   var zaalFilter = $('#filterZaal :selected').text();
   var genreFilter = $('#filterGenre :selected').text();
   $('#formContent>form').remove();
   $('#formContent').html(data);
   $('#filterDag').val(dagFilter);
   $('#filterZaal').val(zaalFilter);
   $('#filterGenre').val(genreFilter);
  }
 });
 return false;
 }

Its a form that i'm deleting and reloading, the function gets callen when a selectbox is selected but the problem is that it only works 1 time, when the form is readded then the handlers are gone.

anyone know how i can fix this?

+4  A: 

Try using .live() to attach the handlers.

Rocket
i changed the .changed() into .live() but the handlers arent attached anymore.
vincent
oh its working now, forgot to add the change after it.
vincent