qTip и .Live () данные - PullRequest
       4

qTip и .Live () данные

1 голос
/ 12 ноября 2010

Короче говоря, В настоящее время я показываю список результатов ... и затем я помещаю фильтр в результаты и извлекаю другой список результатов, используя .live () в jQuery.

Не моя проблема возникает, когда я использую qTip. Который в настоящее время работает примерно так ... без подробностей.

$('.contact').each(function() {
   $(this).qtip({
      // These are my options within here
   });
});

Это если мой код для фильтрации моих результатов с помощью функции .live ().

$('.filterContacts').live('click', function(){
    var filterId = $(this).attr('id');  

    $.ajax({
    url: 'classes/class.Post.php?a=filterContacts',
    dataType: 'html',
    data: {
        filter: filterId 
    },
    success: function (responseText) {
        $(".contacts").html(responseText);
    },
    error: function() {
        alert("Oops... Looks like we're having some difficulties.");  
    }
    });
    return false;
});

Так что теперь мой qTip не любит работать с моими отфильтрованными результатами ... что я могу сделать? Любая помощь будет благодарна!

UPDATE: .contacts - это div, который окружает все .contact div. IE:

<div class="contacts">
  <div class="contact">FistName, LastName</div>
  <div class="contact">FistName, LastName</div>
  <div class="contact">FistName, LastName</div>
</div>

1 Ответ

1 голос
/ 12 ноября 2010

Вы должны выполнить свой код в блоке успеха.

$('.filterContacts').live('click', function(){
        var filterId = $(this).attr('id');  

        $.ajax({
        url: 'classes/class.Post.php?a=filterContacts',
        dataType: 'html',
        data: {
            filter: filterId 
        },
        success: function (responseText) {
            $(".contacts").html(responseText);
            // call your each function here...
    $('.contact').each(function() {
       $(this).qtip({
          // These are my options within here
       });
    });


        },
        error: function() {
            alert("Oops... Looks like we're having some difficulties.");  
        }
        });
        return false;
    });
...