diff options
Diffstat (limited to 'script/custom.js')
-rw-r--r-- | script/custom.js | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/script/custom.js b/script/custom.js index 3269749e..12e760af 100644 --- a/script/custom.js +++ b/script/custom.js @@ -1,3 +1,4 @@ +/* function loadContent(elem, source) { $(elem).html('<div class="progress progress-striped active"><div class="progress-bar" style="width:100%"><span class="sr-only">In Progress....</span></div></div>'); @@ -14,4 +15,20 @@ function selectDir(obj) if (text.substr(0, dirname.length) !== dirname) return; $(this).parent().find('.fileBox')[0].checked = obj.checked; }); -}
\ No newline at end of file +} +*/ + +function updater(url, postdata, callback) +{ + var updateTimer = setInterval(function () { + if (typeof $ === 'undefined') + return; + $.post(url, postdata, function (data, status) { + if (!callback(data, status)) + clearInterval(updateTimer); + }, 'json').fail(function (jqXHR, textStatus, errorThrown) { + if (!callback(errorThrown, textStatus)) + clearInterval(updateTimer); + }); + }, 1000); +} |