数据加载中……
ajax回调函数调用多个参数。 循环调用。
 1    function batchProcessData(data,telArr,index){
 2          if(data==0){    
 3            var option = new Option(telArr[index],telArr[index]);
 4            var counts = $('bindTel').options.length;
 5            $('bindTel').options[counts]=option; 
 6            var restrictionObj = $('bindTel');
 7            var allNum =",";
 8            for(i=0;i<restrictionObj.options.length;i++){
 9                var value = restrictionObj.options[i].value;
10                allNum += value+',';
11            }
12            $('bindTelNo').value=allNum;
13        }    
14        index +=1;
15        if(index==telArr.length){
16            return;
17        }
18        var fieldNameArr = [];
19        var fieldValueArr = [];
20        fieldNameArr[0]='tel_no';
21        fieldValueArr[0]=telArr[index];
22        sysManagerService.isExist('t_user_bind',fieldNameArr[0],fieldValueArr[0],{
23            callback:
24                function(data){
25                    batchProcessData(data,telArr,index);
26                }
27        });
28    }

 1    function batchAddTel(){
 2        var telnum = $('telNo');
 3        var telArr = telnum.value.split(/[^\d-]/g);
 4        var effTelArr = new Array();
 5        for(var i=0;i<telArr.length;i++){
 6            if(""==telArr[i]){
 7                continue;
 8            }
 9            var patrn=/(^[0-9]{3,4}\-[0-9]{7,8}$)|(^[0-9]{7,8}$)|(^[0-9]{11}$)/;
10            if (!patrn.test(telArr[i])){
11                continue;                                               
12            }                                  
13            if($('bindTelNo').value.indexOf(','+telArr[i]+',') !=-1){
14                continue;                                 
15            }      
16            effTelArr.push(telArr[i]);
17        }
18        effTelArr = unique_Array(effTelArr);
19        if(effTelArr.length > 0){
20            var fieldNameArr = [];
21            var fieldValueArr = [];
22            fieldNameArr[0]='tel_no';
23            fieldValueArr[0]=effTelArr[0];
24            sysManagerService.isExist('t_user_bind',fieldNameArr[0],fieldValueArr[0],{//回调函数调用多个参数
25                callback:
26                    function(data){
27                        batchProcessData(data,effTelArr,0);
28                    }
29            });
30        }    
31    }     

posted on 2009-09-27 21:35 R99 阅读(1473) 评论(0)  编辑  收藏


只有注册用户登录后才能发表评论。


网站导航:
博客园   IT新闻   Chat2DB   C++博客   博问