Вопрос

вот код:

<script>
    $(document).ready(function(){
        $.get("realisations.shtml",function(data){$('#realisations').empty().append(data)});
    });
</script>

Мне нужно выполнить $ (" .toexpand "). hide (); убедившись, что данные загружены в div

эта попытка не работает:

<script>
    $(document).ready(function(){
        $.get("realisations.shtml",function(data){$('#realisations').empty().append(data)},function(){$(".toexpand").hide()});
    });
</script>
Это было полезно?

Решение

$(document).ready(function(){
    $.get("realisations.shtml",function(data) {
        $('#realisations').empty().append(data);
        $(".toexpand").hide();
    })
});

Другие советы

<script>
$(document).ready(function(){
    $.get("realisations.shtml",function(data) { 
       $('#realisations').empty().append(data);
       $(".toexpand").hide();
    });
});
</script>

есть ли причина, по которой вы не используете $ (). load ()?

$(document).ready(function(){
    $('#realisations').load("realisations.shtml", function() {
        $(".toexpand").hide();
    });
});
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top