Note that there are some explanatory texts on larger screens.

plurals
  1. POMultiple Ajax Calls while one Ajax call is still running
    primarykey
    data
    text
    <p>I got some progressbar Update Issues. What I like to do is, fire a ajax call which takes some time to complete and during the this call I'd like to fire ajax calls, set by an interval, to update my progressbar.</p> <p>Since I could not find a solution and only found the Browser's restriction, which would match here. It's always max 2 calls active.</p> <p>Still, my second call stays pending in Google Chrome, untill my first (main) call finished.</p> <p>EDIT: full jquery script</p> <pre><code>// update cars cache $('#cars_cache_update_run').bind('click', function(){ // remove button $(this).remove(); // hide import widgets $('#products_import_widget').css('display', 'none'); $('#vehicles_import_widget').css('display', 'none'); $('#orders_import_widget').css('display', 'none'); $('#test_data_widget').css('display', 'none'); // show blind $('#cars_cache_update_info').css('display', 'none'); $('#cars_cache_update_blind').css('display', 'inline'); var carsUpdateInterval = setInterval(function() { getImportState('http://localhost/index.php/import/import_state/cache_update', 'cars_import_progressbar'); }, 1000); // ajax request $.ajax({ url: "http://localhost/index.php/import/cars_cache", async : true, success: function(data){ $('#cars_cache_update_blind').css('display', 'none'); $('#cars_cache_update_success').css('display', 'inline'); clearInterval(carsUpdateInterval); }, error: function(thrownError){ $('#cars_cache_update_blind').css('display', 'none'); $('#cars_cache_update_error').css('display', 'inline'); $('#cars_cache_update_error_msg').html(thrownError); } }); }); function getImportState(url, id) { $.ajax({ url: url, success: function(data){ var json = $.parseJSON(data); $.each(json, function(i, item) { var progressbar_value = json[i]['state']; $( "#"+id ).progressbar({ value: progressbar_value }); }) } }); } </code></pre> <p>Another funny thing, if I call the interval request by $.get I'll get a strange error.. Working with Codeignitor Framework.</p> <pre><code>GET http://localhost/[object%20Object] 404 (Not Found) jquery.1.7.min.js:4 send jquery.1.7.min.js:4 f.extend.ajax jquery.1.7.min.js:4 f.(anonymous function) jquery.1.7.min.js:4 (anonymous function) </code></pre> <p>Many Thanks for your help already, been trying for hours now.. Maybe I'm just a noob.. Haha.</p> <p>rootless</p>
    singulars
    1. This table or related slice is empty.
    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.
 

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