views:

7

answers:

0

how to loop over the jquery .ajax() success function. i m getting openx banner in loop but success function is not iterating and displaying it only first element of the for loop is displayed. here is the example code: This is in html file:

staticurl='http://d1.openx.org/avw.php?zoneid='
zoneidList=new Array('110904','110903','110905');
       for(k=0;k<zoneidList.length;k++)
        {    
             alert(zoneidList[k]);
             zoneid=zoneidList[k];
             index=k;
              $.ajax({
             type: "POST",
             url:'/ajax/',

             data:{"url":zoneid,'index':index} ,     
             success: function(banner){
               alert(banner);
               index=k1.split('$$')[1];
               alert(index);                                     
               $('#flash'+index).append(banner);   
}                  
});  
</script>
</head>
<body>
<div id="flash0"></div>
<div id="flash1"></div>
<div id="flash2"></div>
hai
</body>
</html>

please can anyone tell me how to loop over all the zoneids present