首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >去掉它不起作用

去掉它不起作用
EN

Stack Overflow用户
提问于 2016-07-12 12:08:40
回答 0查看 445关注 0票数 0
代码语言:javascript
复制
<script type="text/javascript">

    $(function(){

            var parent_id = {};
            var father_name = [];
            var father_occupation = [];
            var father_tele_no = [];
            var father_handph = [];
            var mother_name = [];
            var mother_occupation = [];
            var mother_tele_no = [];
            var mother_handph = [];
            var email = [];
            var remark = [];
            var throttledRequest = _.debounce(function(query, process){
                $.ajax({
                    url: '<?= base_url("student/jason_parent"); ?>
                        '
                        ,cache: false
                        ,success: function(data){
                        parent_id = {};
                        father_name = [];
                        console.log(data);
                        _.each( data, function(item, ix, list){
                        father_name.push( item.father_name );
                        parent_id[ item.father_name ] = item.parent_id;
                        father_occupation[ item.father_name ] = item.father_occupation;
                        father_tele_no[ item.father_name ] = item.father_tele_no;
                        father_handph[ item.father_name ] = item.father_handph;
                        mother_name[item.father_name] = item.mother_name;
                        mother_occupation[item.father_name] = item.mother_occupation;
                        mother_tele_no[item.father_name] = item.mother_tele_no;
                        mother_handph[item.father_name] = item.mother_mother_handph;
                        email[item.father_name] = item.email;
                        remark[item.father_name] = item.remark;
                        });

                        process( father_name );
                        }
                        });
                        }, 300);

                        $(".typeahead").typeahead({
                        source: function ( query, process ) {

                        throttledRequest( query, process );

                        }
                        , updater: function ( selectedName ) {

                        $( "#id" ).val( parent_id[ selectedName ]);
                        $( "#father_occupation" ).val( father_occupation[ selectedName ]);
                        $( "#father_tele_no" ).val( father_tele_no[ selectedName ]);
                        $( "#father_handph" ).val( father_handph[ selectedName ]);
                        $( "#mother_name" ).val( mother_name[ selectedName ]);
                        $( "#mother_occupation" ).val( mother_occupation[ selectedName ]);
                        $( "#mother_tele_no" ).val( mother_tele_no[ selectedName ]);
                        $( "#mother_handph" ).val( mother_handph[ selectedName ]);
                        $( "#email" ).val( email[ selectedName ]);
                        $( "#remark" ).val( remark[ selectedName ]);
                        return selectedName;
                        }
                        });
                        });
    </script>

它不工作

EN

回答

页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38319885

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档