zoukankan      html  css  js  c++  java
  • flexbox自动完成

    1.引入文件

    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
    
    <link href="/css/flexbox/main.css" rel="stylesheet" type="text/css" />
    
    <link rel="stylesheet" type="text/css" href="/css/flexbox/jquery.flexbox.css" />
    
    
    <script type="text/javascript" src="/js/flexbox/jquery.flexbox.js"></script>

    2.获取json数据

    $(function() {
            // Default, when the number of results exceeds the paging threshold
            ajaxgetteacher("<!--{$aData.user_name}-->");
            //alert("<!--{$aData.user_name}-->");
          });
          function ajaxgetteacher(teachername){
                $.ajax({
                        type:"POST",
                        url:"/default/index/ajax/do/getteacher",
                        data:"",
                        success:function(response){
                            var teachers = {};
                            teachers.results = eval('('+response+')');
                            teachers.total = teachers.results.length;
                            $('#user_id').flexbox(teachers,{
                              initialValue: teachername
                            });
                        }
                    });
            }

    3.php获取数据

    case "getteacher":
                    $aTeaInfo = $daoTeacher->getTeacher();
                    foreach($aTeaInfo as $k=>$v){
                        $teainfo[$k]['id'] = trim($v['user_id']);
                        $teainfo[$k]['name'] = trim($v['realname']);
                    }
                    $teainfo = json_encode($teainfo);
                    echo $teainfo; 
                    break;

    4.写入界面

    <div id="user_id">
                              </div>

     效果如下:

  • 相关阅读:
    请教提高上百万行数据insert速度的“经典”方法
    poj1411
    poj1422
    poj1661
    poj1664
    poj1405
    交往艺术与沟通技巧[推荐]
    不可不听的10个职场故事
    也谈如何“领导”你的领导
    十个让爱情稳固的经典好习惯
  • 原文地址:https://www.cnblogs.com/jiqing9006/p/3412822.html
Copyright © 2011-2022 走看看