spot7.org logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories

make a loop wait till previous pass has completed


Use a recursive way like this instead of a loop..

<script type='text/javascript'>
function pageLoad(links,site)
{
var links = links.split(","); 
var i=0;
postNow();
function postNow() { 
    var link = links[i]
    $('#info'+(i+1)).html('Processing');
    $.post( 
         "downloadlinks.php",
         { link: link, site: site, iter:i},
         function(data) {
            if(date == "ok")
            {
                $('#info'+(i+1)).html('Finished');
            }else
            {
                $('#info'+(i+1)).html('Failed');
            }
            i++;
            if (i<links.length){
                postNow();
            }
         });
    }
 }
</script>

Categories : Javascript

Related to : make a loop wait till previous pass has completed
Keep track of completed Futures
I would suggest using the standard Java AtomicInteger. You can increment it using the incrementAndGet() method, and obtain the current value via its get() method. import java.util.concurrent.atomic.AtomicInteger ... val completed = new AtomicInteger() val futures = for(i <- 0 until nSteps) yield future { ... val content = blocking { ... http request ... } process(content) compl

Categories : Scala
send a second request after the first is completed
Don't call the second request until the first completes: - (void) requestData: (int) forPlot { ... [urlRequest startWithCompletion:^(URLRequest *request, NSData *data, NSError *error, BOOL success) { if (success) { if (forPlot == 1) { ... dataForPlot = 2; [self requestData: dataForPlot]; } else if (forPlot == 2) {

Categories : IOS
Detect all XMLHttpRequest calls are completed
If you can use jQuery you can use jQuery AJAX Deferred interface/methods and $.when method. $.ajax/$.post/$.get and other jQuery AJAX methods always return jQuery Deferred object: $.when($.get('someUrl'), $.get('anotherUrl')).then(function () { //all request complete }); In native javascript you can use native Promise or any promise library: http://www.javascriptoo.com/rsvp-js http://www

Categories : Javascript
Async & Await to determine when button disable event completed
Maybe you are looking for something like this? private async Task<int> FilesCountAsync() { .... } protected async void btnStart_Click(object sender, EventArgs e) { btnStart.Enabled = false; var fileCount = await FilesCountAsync(); SetFileCountInUI(fileCount); btnStart.Enabled = true; }

Categories : Dotnet
Delayed job to check if a carrierwave_direct upload has been completed and attached to a model
This is how I did it. def new # STEP 1: Show upload dialog that user can drop an image unto @image = current_user.portfolio.images.new.images # Status 201 returns an XML @image.success_action_status = "201" end def crop # STEP 2: A file is now on Amazon S3, but no record exists in the database yet. Make the user crop the image and enter a title. # Meanwhile, also setup a

Categories : Misc
Recently Add
Busy Indicator while page is loading
parent.document.getElementById and images path
Can not get bootstrap datetime picker to display properly
reading select box jquery issues
DC.JS Pie Chart + Select Deslect from external JavaScript function
Why would I ever need to cancelAnimationFrame()
Angular.ui alert doesn't close
HTML/JS How to position a rectangle relative to 'any' side of the parent canvas element
parse variable to xml
C# Dictionary equivalent in JavaScript
ExtJS Dashboard Panel Fit Panel Vertically
jQuery cross domain ajax call - Interpreted as script but transferred with MIME type text/xml
Reactjs map returns unexpected token }
Working with multiple pages in apache cordova and vs2013
Resize iframe to loaded content
Why 13596*0.1 is different than 13596/10?
AngularJS Validate all forms on application load
javascript open popup without menu/url/titlebar/scrollbar/anything
Can I use Razor syntax inside Javascript included in a ScriptBundle?
How to show a box for comment reply with id
parse name from user input when using jquery serialize
How to parse and load javascript object?
Marionette not navigating to the same url
Adding Google+ Sign in button to website
GRUNT - Install Grunt Packages?
how should I create the path of templateUrl property in Angular ui-router?
Update mysql database with jquery array using ajax
Run the same function on each item in a list / array
Get all ticks values (NVD3)
Button Click Event not Passing input String to MVC Controller Method
© Copyright 2017 spot7.org Publishing Limited. All rights reserved.