var d = dialog({ contentType: 'load', skin: 'bk-popup' }); $(function(){ queryData(); }) function queryData(){ var url = "/patient/scheme/getControlObjectives"; sendPost(url, null, 'JSON', 'GET', queryFailed, function(res) { if(res.status == 200) { var suggerHtml = template('sugger-tmp', res.data.patientAimBloodSugger); $("#sugger-tagert").append(suggerHtml); var pressureHtml = template('pressure-tmp', res.data.patientAimBloodPressure); $("#pressure-tagert").append(pressureHtml); var sportsHtml = template('sports-tmp', res.data.patientAimSports); $("#sports-target").append(sportsHtml); } else { queryFailed(res); } }); } function queryFailed(res) { d.close(); if(res && res.msg) { dialog({ contentType: 'tipsbox', skin: 'bk-popup', content: res.msg }).show(); } else { dialog({ contentType: 'tipsbox', skin: 'bk-popup', content: '加载失败' }).show(); } }