$(function () { var $btnRefresh = $('#refreshTask'); var htmlTask = '
  • {0}{1}{2}
  • '; function listData() { $btnRefresh.toggleClass('fa-spin'); $.bc({ url: Tasks.url, method: 'GET', swal: false, callback: function (result) { if (result) { var content = result.map(function (task) { return $.format(htmlTask, task.TaskName, task.UserName, task.AssignTime, task.ID); }).join(''); $('#list-task').html(content); } $btnRefresh.toggleClass('fa-spin'); } }); } listData(); $btnRefresh.on('click', function () { listData(); }); })