jquery - Unable to get cached AJAX data dimensions -
i'm trying make ajax calls more efficient caching data has been ajaxed. need render data in way depending on of resulting data's dimensions.
when calling data first time, dimensions can read, , well. cache works enough, i'm having huge amount of difficulty getting dimensions of elements within cached data.
below simplified version of i'm doing (with identical problems):
var cache = {}; // ajax part function getdetails(request){ return jq.get(request); }; // filter & render ajax data function renderdata(data){ var endresult = $(data).find('#thetargetelement'); endresult.appendto($placehold); $placehold.find('#thetargetelement').css('visibility','hidden'); // log dimensions on ajax data fine // cached data returns height 0 console.log( height of elements within data ); }; // click handler jq('#slides').on('click', '.slidelink', function(e){ e.preventdefault(); var target = jq(this).attr("href"); if ( cache[target] ) { // if data exists in cache object var $cached = cache[target] renderdata( $cached ); } else { getdetails(target) .done( function(result) { cache[target] = result; renderdata(result); }) } });
the appended data there , appears on page - can't seem use measurements.
Comments
Post a Comment