function refreshTable() {
refresh = parseInt($('#itemsfilter-timeout').val());
if (refresh < 5) {
refresh = 5;
$('#itemsfilter-timeout').val(refresh);
}
if ($('#refreshonoff').is(':checked')) {
var form = $('#form-filter');
$.pjax({
container: "#pj-grid",
timeout: 60000,
url: form.attr('action'),
data: form.serialize()
})
.done(function () {
setTimeout(refreshTable, refresh * 1000);
});
}
};
function reload() {
var form = $('#form-filter');
$.pjax({
container: "#pj-grid",
timeout: 60000,
url: form.attr('action'),
data: form.serialize()
});
}
как мне вынести общий код в отдельную ф-ю
var form = $('#form-filter');
$.pjax({
container: "#pj-grid",
timeout: 60000,
url: form.attr('action'),
data: form.serialize()
});