var $ = require('yoho-jquery'); var tableTmp = require('hbs/3party/activate-tbl.hbs'); var $startTime = $('.start-time'); var $endTime = $('.end-time'); function time() { var date = new Date(), year = date.getFullYear(), month = (date.getMonth() + 1), day = date.getDate(); month = month < 10 ? '0' + month : month; day = day < 10 ? '0' + day : day; return year + '-' + month + '-' + day; } function getList(params) { $.ajax({ url: '/3party/activate-count/getList', type: 'get', data: params, success: function(list) { $('.table-data').html(tableTmp({list: list})); } }); } $(function() { var timeData = time(); $startTime.val(timeData); $endTime.val(timeData); getList({ startTime: timeData, endTime: timeData }); $('.query-btn').on('click', function() { getList({ startTime: $startTime.val(), endTime: $endTime.val() }); }); });