代码之家  ›  专栏  ›  技术社区  ›  Justin

qtip和.live()数据

  •  1
  • Justin  · 技术社区  · 14 年前

    简而言之, 我当前正在显示结果列表…然后我在结果上放置一个过滤器,并使用jquery中的.live()提取另一个结果列表。

    当我使用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不想处理我的过滤结果…有什么我能做的吗?任何帮助都是值得感激的!

    更新: .contacts是包围所有.contact div的一个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 回复  |  直到 14 年前
        1
  •  1
  •   Teja Kantamneni    14 年前

    您应该在success块中执行代码。

    $('.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;
        });
    
    推荐文章