日期:2014-05-17  浏览次数:20475 次

怎么使jquery的each循环每执行一次,停一段时间再执行下一次循环呢
怎么使jquery的each循环每执行一次,停一段时间再执行下一次循环呢
,用了setTimeout,没效果。。如下是源代码
$(function(){
         $("#btn").click(function(){
             $.ajax({
                    type:"POST",
                    url:"Common.asmx/SendMsgs",
                    data:"{}",
                    contentType:"application/json",
                    dataType:"json",
                    success:function(data){   
                    var jsonData=data.d;
                    var jsonTable=jQuery.parseJSON(jsonData);
                    $.each(jsonTable.jsonName,function(i,item){
                    var oldHtml="<span>我:&nbsp;"+item.id+"</span><br/>"+"<span>"+item.age+"</span>"; 
                        $("<p>").html(oldHtml).appendTo($("div")).css({color:"red"});
                        setTimeout("function(){return false;}",5000);                        
                    });        
                        
                    },
                    error:function(){
                        alert("error");
                    }
                    
             });
        });
    });

===========WEB服务==============
[WebMethod]
        public string SendMsgs()
        {
          &nbs