jquery - Prevent Ajax load from loading src more than once -


i loading bunch of lis html page via ajax load (code below call), works fine, after html page of lis has been loaded in, seems calls same html source 4 times @ once , messes up... doing wrong???

$.ajax({ cache: false, url: 'slides.html', success: function(data) {             jwloadinitialslider();           $(this).show();           $(".sliderloader").fadeout(3000);           settimeout(function(){          $(".carouselcontentwrapper").css("height","auto");          }, 2000);     } }); 

is there way kill function once has loaded , performed success functions?

outside ajax call define variable

var slideloaded = "no"; 

then inside ajax success function this:

if(slideloaded=="no"){   slideloaded = "yes";   jwloadinitialslider(); } 

so way, if ajax call called more times won't call slider thing again.


Comments

Popular posts from this blog

jQuery Mobile app not scrolling in Firefox -

c++ - How to add Crypto++ library to Qt project -

php array slice every 2th rule -