0

How can I get the heights of some divs I called with an ajax query?

I tried:

var size = 0;

$.ajax({
    type: 'GET', 
    url: 'load.html', 
    success: function(data, textStatus, jqXHR) {
        var el = $(data);
        el.find('.test').addBack().filter('.test').each(function(){
            size += parseInt($(this).height());
        });
        alert(size);
    }
});

knowing that the html of load.html is

<div class="test">
    qwertry<br>
    qwertry<br>
    qwertry
</div>

<div class="test">
    qwertry
</div>

but the alert is "0"

4

0 回答 0