2016-07-09 8 views
-1

jQueryコードに問題があります。 私は、divが隠されていて、マウスがの兄弟divのときに表示されます。 しかし、私のAJAX関数が呼び出されると、jQueryは機能しません。AJAXクエリの後にjQueryが機能しない

<div class="parent"> 
    <div class="theDiv" style="display:none"> 
    </div> 
    <div class="sibling"> 
    </div> 
</div> 
$('.sibling').hover(function(){ 
    $(this).parent().find('.theDiv').fadeIn('fast'); 
}); 

$('.catFilterSelect').change(function(){ 
    $.ajax({ 
    url:"load_data.php", 
    method:"POST", 
    data:{ 
     reg:a, 
     price:b, 
     type:c, 
     subject:d, 
     city:e, 
     typeSubject:typeSubject 
    }, 
    dataType:"text", 
    success:function(data){ 
     $('.catPostsBox .catPost').remove(); 
     $('.catPostsBox').append(data); 
    } 
    }); 
}) 

このスクリプトは、AJAXの前に動作しますが、それは

+3

は、AJAXの一部を含んで動作しません後... OP – guradio

+0

に関連するすべてのコードを含め、あなたは関連するすべてのコード場所を表示することができますこの '.catPostsBox'はあなたの答えにデモ – guradio

答えて

0
<div class="parent"> 
    <div class="theDiv" style="display:none"> 
    </div> 
    <div class="sibling"> 
    </div> 
</div> 
<script> 
$(function(){ 
    $('.sibling').hover(function(){ 
      $(this).parent().find('.theDiv').fadeIn('fast'); 
    }); 
}); 
or -- both are same 
$(document.ready(function(){ 
    $('.sibling').hover(function(){ 
      $(this).parent().find('.theDiv').fadeIn('fast'); 
    }); 
}); 

</script> 
<script> 
$(function(){ 
$('.catFilterSelect').change(function(){ 
    $.ajax({ 
    url:"load_data.php", 
    method:"POST", 
    data:{ 
     reg:a, 
     price:b, 
     type:c, 
     subject:d, 
     city:e, 
     typeSubject:typeSubject 
    }, 
    dataType:"text", 
    success:function(data){ 
     $('.catPostsBox .catPost').remove(); 
     $('.catPostsBox').append(data); 
    } 
    }); 
}) 
)}; 
</script> 
+0

tnxをよく見せていますか?しかし動作しません –

関連する問題