Ajax Array Json 示例

function functionName(){
           var list=new Array();
           $("td.classA").each(function(){
               list.push($(this).attr('id'));
              });

           if(list.length > 0){
               $.ajax({
                    type: "POST",
                    url: "<?=Yii::app()->createUrl('......')?>",
                    data: {"Ids": list.join()},
                    dataType: "json",
                    success:function(data){
                        //console.log(data);
                        for(var i in data){
                            if(data[i].COUNT>1){
                                var linkHref='<?=Yii::app()->createUrl('....')?>'+'&articleIds='+data[i].IDS;
                                var linkHtml='<a target="_blank" href="'+linkHref+'">'+data[i].COUNT+'</a>';
                                $('td[aaa="'+data[i].MD5_ID+'"]').html(linkHtml);
                            }
                        }                         
                    }
                });
           }
       }
posted on 2016-05-13 10:06  思静  阅读(285)  评论(0编辑  收藏  举报