【发布时间】:2011-04-14 09:44:41
【问题描述】:
更新:
我正在尝试让 jquery smart poll 为我工作。如果进程在前 2 秒内准备好,它工作正常,但如果没有,它不会按预期重试。我还想让重试在一定次数后超时。
https://github.com/hmert/jquery-smart-poll
<script type="text/javascript" charset="utf-8">
$("#load_availables").toggle()
$.poll(2000,function(retry){
$.getScript('update_availables.js?job_id=<%= @bed.job_id %>&space_id=<%= @space.id %>', function(response, status){
if (status == 'success')
$("#load_availables").toggle() //works fine if ready
else
retry() //does not retry at all
})
})
</script>
【问题讨论】:
标签: jquery ruby-on-rails jquery-plugins delayed-job polling