Try making sites a global variable, if that doesn't work put your ajax call a function and pass i and possibly your other vars too or make them global. One thing you may want to look at is looping this in a way that all of your ajax calls are not all at the same time, maybe im mistaken but i don't believe that they que up like fx do, instead you should look at running them in sequence.
You may need to make some of your vars global or On Feb 25, 8:55 pm, Will22 <vadim.myn...@gmail.com> wrote: > Here is my code: > > $(document).ready(function(){ > > $('#submiter').click(function() { > > var sites= > ["12seconds","brightkite","colourlovers","corkd","Dailymotion"]; > > var username = $("input#username").val(); > > for (var i=0;i<sites.length;i++){ > $.ajax({ > > method: "get",url: "boo.php",data: > "site="+sites[i]+"&username="+username, > > beforeSend: function(){$("#loading").show > ("fast");}, > > complete: function(){ $("#loading").hide > ("fast");}, > > success: function(html){ > $("#"+sites[i]).html(html); > > } > }); > } > }); > > }); > > On this line method: "get",url: "boo.php",data: "site="+sites[i] > +"&username="+username, > sites[i] just fine, > but here: > success: function(html){ > $("#"+sites[i]).html(html); > > sites[i] is undefined > > Please advise > > Thank you