這期內(nèi)容當(dāng)中小編將會(huì)給大家?guī)碛嘘P(guān)layui Ajax請求給下拉框賦值,文章內(nèi)容豐富且以專業(yè)的角度為大家分析和敘述,閱讀完這篇文章希望大家可以有所收獲。
嘉黎網(wǎng)站建設(shè)公司創(chuàng)新互聯(lián)建站,嘉黎網(wǎng)站設(shè)計(jì)制作,有大型網(wǎng)站制作公司豐富經(jīng)驗(yàn)。已為嘉黎千余家提供企業(yè)網(wǎng)站建設(shè)服務(wù)。企業(yè)網(wǎng)站搭建\成都外貿(mào)網(wǎng)站制作要多少錢,請找那個(gè)售后服務(wù)好的嘉黎做網(wǎng)站的公司定做!
如下所示:
<!DOCTYPE html> <html> <head> <title>排課設(shè)置</title> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> <meta name="renderer" content="webkit"> <link rel="stylesheet" href="/vendor/layui/css/layui.css" rel="external nofollow" media="all"> </head> <body> <div class="layui-form" lay-filter="boardFilter"> <hr> <div class="layui-form-pane layui-tab-content" > <div class="layui-inline"> <label class="layui-form-label" >查詢內(nèi)容</label> <div class="layui-input-inline" > <input class="layui-input" name="schName" placeholder="請輸入學(xué)校名稱" id="schName" autocomplete="off"> </div> </div> <div class="layui-inline"> <label class="layui-form-label" >學(xué)期</label> <div class="layui-input-inline" > <select name="termId" id="termId"> </select> </div> </div> <div class="layui-inline"> <label class="layui-form-label" >列表狀態(tài)</label> <div class="layui-input-inline" > <select name="msgType" id="msgType"> <option value="">全部狀態(tài)</option> <option value="1">申請中</option> <option value="2">確認(rèn)申請</option> <option value="3">已經(jīng)發(fā)布</option> <option value="0">已撤銷</option> </select> </div> </div> <div class="layui-inline toolbarBtn"> <button class="layui-btn layui-btn-sm layui-btn-normal" lay-submit="" lay-filter="getSearch" id="getSearch" name="getSearch"><i class="layui-icon"></i> 查詢</button> </div> </div> </div> <table class="layui-table" id="infoTable" lay-filter="filterTable"></table> <script type="text/javascript" src="/vendor/jquery/jquery-1.11.3.min.js"></script> <script type="text/javascript" src="/vendor/layui/layui.js"></script> <script type="text/html" id="action"> <a class="layui-btn layui-btn-xs layui-btn-primary" lay-event="view">查看</a> {{# if(d.status===2){ }} <a class="layui-btn layui-btn-xs" lay-event="send">推送</a> {{# } }} {{# if(d.status===3){ }} <a href='{{d.url}}' class='layui-btn layui-btn-xs'>下載排課表</a> {{# } }} </script> <script type="text/html" id="courseArrangeFlag"> {{# if(d.courseArrangeFlag===0){ }} <h>行政班排課</h> {{# } else { }} <h>走班排課</h> {{# } }} </script> <script type="text/html" id="status"> {{# if(d.status===0){ }} <h>撤消申請</h> {{# } else if(d.status===1){ }} <h>申請中</h> {{# } else if(d.status===2){ }} <h>排課中</h> {{# } else if(d.status===3){ }} <h>已經(jīng)推送</h> {{# } else if(d.status===4){ }} <h>已發(fā)布課程表</h> {{# } }} </script> <script> layui.use(['table','layer'], function() { var table = layui.table ,form = layui.form; var $ = layui.jquery, layer = layui.layer; var tableIns = table.render({ elem: '#infoTable' ,url: '/web/courseArrange/list' ,id: 'idTable' ,page: true ,limits: [10,20,50,100] ,limit: 10 //默認(rèn)采用10 ,cols: [[ //標(biāo)題欄 {checkbox: true, fixed: true} ,{field: 'courseArrangeId', title: '序號', fixed: true} ,{field: 'schName', title: '學(xué)校名稱'} ,{field: 'courseArrangeFlag', title: '排課類型', templet: '#courseArrangeFlag'} ,{field: 'termName', title: '學(xué)期'} ,{field: 'recordTime', title: '申請時(shí)間'} ,{field: 'status', title: '狀態(tài)', templet: '#status'} ,{field: 'action', title: '操作', templet: '#action'} ]] }); //監(jiān)聽管理操作 form.on('switch(schControlInput)', function(obj){ var normalValue if(obj.elem.checked){ normalValue = '0'; }else{ normalValue = '1'; } $.ajax({ url:'/school/editIsNormalSchool', type:"POST", dataType:"json", data:{"schId":this.value, "statusValue":normalValue}, success:function(res){ location.reload(); }, }); }); // 監(jiān)聽Table工具條 table.on('tool(filterTable)', function(obj) { var data = obj.data; if (obj.event === 'view') { location.href="courseArrangeView.html?id=" rel="external nofollow" +data.courseArrangeId+"&schId="+data.schId+"&areaId="+data.areaId; }else if (obj.event === 'send') { layer.open({ type: 2, title: '導(dǎo)入并推送', maxmin: true, shadeClose: false, //點(diǎn)擊遮罩關(guān)閉層 area : ['700px' , '600px'], content: '/page/business/course/courseArrangeUpload.html?schId='+data.schId+'&areaId='+data.areaId+'&termId='+data.termId+'&courseArrangeFlag='+data.courseArrangeFlag+'&phone='+data.phone ,btn: '關(guān)閉' ,btnAlign: 'c' //按鈕居中 ,shade: 0 //不顯示遮罩 ,yes: function(){ layer.closeAll(); } ,end: function () { location.reload(); } }); } }); form.on('submit(getSearch)', function(data){ table.reload('idTable', { where: data.field }); }); $(document).ready(function () { $("select[name=termNm]").empty(); $.ajax({ async: false, type: "POST", url: "/web/courseArrange/termList", dataType: "json", data: {}, success: function (res) { var opt = "<option value='' selected = \'selected\'>全部</option>"; $("select[name=termId]").append(opt); for(var i=0; i<res.data.length; i++){ var option="<option value=\""+res.data[i].termId+"\""; option += ">"+res.data[i].termName+"</option>"; //動(dòng)態(tài)添加數(shù)據(jù) $("select[name=termId]").append(option); } layui.form.render('select','boardFilter'); } }); }); }); </script> </body> </html>
上述就是小編為大家分享的layui Ajax請求給下拉框賦值了,如果剛好有類似的疑惑,不妨參照上述分析進(jìn)行理解。如果想知道更多相關(guān)知識,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道。
新聞名稱:layuiAjax請求給下拉框賦值
瀏覽地址:http://muchs.cn/article10/iegjdo.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)頁設(shè)計(jì)公司、小程序開發(fā)、做網(wǎng)站、營銷型網(wǎng)站建設(shè)、域名注冊、商城網(wǎng)站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)