X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=libs%2Fweb%2Fluasrc%2Fview%2Fcbi%2Fapply_xhr.htm;h=d519a5f59c39300e71772ce9bad894d9ea34ac45;hp=11851ad8100314b2e5e5e877b1522ee27b1a67af;hb=4121f34ac005ed0af727267fd96d9f5492664cce;hpb=e077f36436dda2461ffeeb44fac3f55f21e94850 diff --git a/libs/web/luasrc/view/cbi/apply_xhr.htm b/libs/web/luasrc/view/cbi/apply_xhr.htm index 11851ad81..d519a5f59 100644 --- a/libs/web/luasrc/view/cbi/apply_xhr.htm +++ b/libs/web/luasrc/view/cbi/apply_xhr.htm @@ -20,35 +20,33 @@ $Id$ apply_xhr.get('<%=luci.dispatcher.build_url("servicectl", "restart", table.concat(configs, ","))%>', null, function() { - var intv = window.setInterval( - function() { - apply_xhr.abort(); - apply_xhr.get('<%=luci.dispatcher.build_url("servicectl", "status")%>', null, - function(x) { - if( x.responseText == 'finish' ) + var checkfinish = function() { + apply_xhr.get('<%=luci.dispatcher.build_url("servicectl", "status")%>', null, + function(x) { + if( x.responseText == 'finish' ) + { + var e = document.getElementById('cbi-apply-<%=id%>-status'); + if( e ) { - window.clearInterval(intv); - - var e = document.getElementById('cbi-apply-<%=id%>-status'); - if( e ) - { - e.innerHTML = '<%:Configuration applied.%>'; - window.setTimeout(function() { - e.parentNode.style.display = 'none'; - <% if redirect then %>location.href='<%=redirect%>';<% end %> - }, 1000); - } + e.innerHTML = '<%:Configuration applied.%>'; + window.setTimeout(function() { + e.parentNode.style.display = 'none'; + <% if redirect then %>location.href='<%=redirect%>';<% end %> + }, 1000); } - else - { - var e = document.getElementById('cbi-apply-<%=id%>-status'); - if( e && x.responseText ) e.innerHTML = x.responseText; + } + else + { + var e = document.getElementById('cbi-apply-<%=id%>-status'); + if( e && x.responseText ) e.innerHTML = x.responseText; - } + window.setTimeout(checkfinish, 1000); } - ); - }, 1000 - ) + } + ); + } + + window.setTimeout(checkfinish, 1000); } ); ]]>