仿照SQL取出`flag==true`的物件

仿照SQL取出flag==true的物件

success: function(res) {      console.log(res);      const showHospital = res.filter(function(element) {        return element.flag == true      })      } 

完整版

function his_data() {      $.ajax({        url: '<?php echo site_url('HIS/GetHIS'); ?>',        method: 'get',        dataType: 'json',        success: function(res) {          console.log(res);          const showHospital = res.filter(function(element) {            return element.flag == true          })          console.log(showHospital)          renderHeaderRow(showHospital); //渲染标题列的内容(2间医院)          renderRowOptions(showHospital); //渲染标题列的下拉式选单(之后医院会增加)          changeHospital(showHospital); //标题列下拉之后改变医院的标题          Object.keys(showHospital[0]).forEach(element => {            if (element != 'id' && element != 'attribute' && element != 'title')              renderFixedItems(showHospital, element);          });          renderColValues(showHospital);          // addItem(res); //增加项目栏位          // changeItem(res); //依据项目栏位改变内容        },        error: function(err) {          console.log(err)        },      });    }    ```

关于作者: 网站小编

码农网专注IT技术教程资源分享平台,学习资源下载网站,58码农网包含计算机技术、网站程序源码下载、编程技术论坛、互联网资源下载等产品服务,提供原创、优质、完整内容的专业码农交流分享平台。

热门文章