Saturday, 15 May 2010

javascript - Height of div after appending elements via ajax -



javascript - Height of div after appending elements via ajax -

say ajax phone call retrieve json , info appended div #example, , want obtain height of #example using $('#example').height(). if obtain height right away, items may not appended yet. trying obtain height within success clause of ajax phone call @ end after appending loops, appending action must not completed yet because maintain getting smaller height expected. favorable course of study of action have accurate timing in obtaining height of #example?

did seek obtaining height on success of ajax call?

$.ajax({ url: '/example', datatype: 'json', success: function(data) { $('#example').height(); }, complete: function(data) { $('#example').height(); } });

if still doesn't work, seek using settimeout 500 miliseconds makes sure $('#example') has been populated. i've heard of "complete" param ajax.

javascript jquery

No comments:

Post a Comment