Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If I understand correctly your problem is not with the ajax operation, but rather the <code>serviceSucess</code> function, as it is executed synchronously. So I guess a better answer could be provided if we saw this function implementation. Generally, you shouldn't have long sync-functions in javascript. I could suggest something, though (with a warning)</p> <p>let's say you can divide your code to 4</p> <pre><code>a(response); b(response); c(response); d(response); </code></pre> <p>each takes 100ms, together it's 400ms</p> <p>if they can run on parallel (meaning, the order doesn't matter, in javascript you can't run things in parallel) we could write it as follows:</p> <pre><code>setTimeout(function(){ a(response); }, 0); setTimeout(function(){ b(response); }, 0); setTimeout(function(){ c(response); }, 0); setTimeout(function(){ d(response); }, 0); </code></pre> <p>(or you could use <a href="https://github.com/caolan/async#paralleltasks-callback" rel="nofollow">async.parallel</a>)</p> <p>if they should run in series you could use <a href="https://github.com/caolan/async#seriestasks-callback" rel="nofollow">async.series</a> (similar to async.parallel), or plain java script (just nest the setTimeout-s) to:</p> <pre><code>async.series({ a: function(callback){ a(response); callback(); } b: function(callback){ b(response); callback(); } c: function(callback){ c(response); callback(); } d: function(callback){ d(response); callback(); } }, function(err, results){ // the series has ended }); </code></pre> <p>again, what I wrote could be an overkill if we could minimize dom manipulations somehow.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload