Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

javascript - jquery: event for when ajax loaded content is all loaded (including images) -


i'm loading in html via ajax, need event catch on when new images loaded...

becuase it's in div , not whole page, can't use $(window).load(....

i've tried following doesn't work:

$('.banners_col img:last').load(function(){..... 

you need target results of ajax call before inserting them in dom.

so need use callback method provided jquery reason.

$('#load').click(function(){     // inside handler calls ajax      //you ajax call here     $.get('the_url_to_fetch',function(data){          // create in-memory dom element, , insert ajax results         var $live = $('<div>').html(data);          // apply load method images in ajax results         $('img',$live).load(function(){            // each image loaded         });          // add ajax results in dom         $('selector_where_to_put_the_response').html($live.children());     });  }); 

example @ http://www.jsfiddle.net/gaby/sj7y2/


if there multiple images in ajax response , want notified when all of them loaded use modified version

$('#load').click(function(){     // inside handler calls ajax      //you ajax call here     $.get('the_url_to_fetch',function(data){          // create in-memory dom element, , insert ajax results         var $live = $('<div>').html(data);         // count number of images         var imgcount = $live.find('img').length;          // apply load method images in ajax results         $('img',$live).load(function(){            // each image loaded             imgcount--;            if (imgcount==0)            {                // code in here called when images have loaded.            }         });          // add ajax results in dom         $('selector_where_to_put_the_response').html($live.children());     });  }); 

example @ http://www.jsfiddle.net/gaby/sj7y2/1/


if remove comments , empty lines, not code :) not intimidated..


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -