Questions tagged [jquery-deferred]

jQuery's deferred (also known as promises and futures) can be used to manage callback queues

jQuery.Deferred(), introduced in version 1.5, is a chainable utility object that can register multiple callbacks into callback queues, invoke callback queues, and relay the success or failure state of any synchronous or asynchronous function.

1147 questions
0
votes
0 answers

nested fetch using deferred in backbone

I am trying to run multiple fetchs to populate a collection which is a property of a model. I receive all information I want to get, but as soon as my function is done every group has the same members (the members which have been fetched the…
nik
  • 2,114
  • 3
  • 22
  • 43
0
votes
3 answers

Returning an object "instance" asynchronously through JavaScript

Besides jQuery's AJAX functions I'm very limited in my understanding of "asynchronous" JavaScript. I've created a system where I'm loading external Javascript files in as 'modules' in order to keep things tidy and lightweight. The main inspiration +…
zesda
  • 418
  • 6
  • 18
0
votes
2 answers

How to know if animate.css animation is completed with addClass in backbone view?

I'm using animate.css to put some nice effects to my backbone views. One of the animations that I'm using is the flipOutX when a list item is deleted. Here is my drop function: drop: function() { var that = this; this.$el.addClass('animated…
Michael
  • 2,436
  • 1
  • 36
  • 57
0
votes
1 answer

execute DefferedObjs asynchronously

var array = [DefferdObj, DefferdObj, DefferdObj, DefferdObj]; array[0].then array[1].then array[2].then ・ ・ ・ I want to execute DefferedObj asynchronously. This array can be changed dinamically.
hoshipeace
  • 51
  • 6
0
votes
3 answers

How to pass a args from a jQuery defered

I have a Backbone model that fetch some data, process the data and then a function should get the processed data. $.when(model.fetch()) .done(function(){ return model.processData() }) .then(function(processedData){ //make something…
Andreas Köberle
  • 106,652
  • 57
  • 273
  • 297
0
votes
2 answers

jQuery Deferred usage

Am using $.Deferred() to wait for asynchronous call and then get data from it. Tried this so far : http://jsfiddle.net/RMSbx/1/ var result = ""; function asyncCallWrapper () { return $.Deferred(function(def) { asyncCallFunction(arg1, function (…
GoodSp33d
  • 6,252
  • 4
  • 35
  • 67
0
votes
1 answer

JQuery load multiple url's and return only one deferred at the end

I've a array of url's. I like to load each of them and append the content to the element. var myStrArray = ["http://www.google.de", "http://www.facebook.de", "http://www.lycos.de"]; //Initialize local deferred for myStrArray var myDeferredArray =…
MR.ABC
  • 4,712
  • 13
  • 44
  • 88
0
votes
1 answer

Splitting an ajax get payload

I am having a pretty big amount of data by my standards (200 rows of data) and to load all of them at once is taking a while and most users are not digging my 'loading the awesome' thing i have going on in my table which takes around 5 or more…
Gandalf
  • 1
  • 29
  • 94
  • 165
0
votes
2 answers

Return an object from a function that has nested ajax calls

I would like to write a javascript function that returns informations from youtube videos; to be more specific I would like to get the ID and the length of videos got by a search, in a json object. So I took a look at the youtube API and I came out…
user1012480
  • 752
  • 2
  • 11
  • 24
0
votes
2 answers

jsfiddle - return html with jquery when

while trying to echo back some html on jsfiddle using jquery deferreds, I'm not getting any data back. function showData(data1, data2) { console.log(data1[0]); console.log(data2); } function method1() { return $.ajax({ type:…
1252748
  • 14,597
  • 32
  • 109
  • 229
0
votes
3 answers

jquery - do something after everything is done -

I have a set of functions to run, in sequence, but the first one has an asynchronous sub-function. I want the second highest-level function to run only after the async function completes. Any idea how I do this? File A: one(); two(); // I don't…
Scott
  • 1,862
  • 1
  • 33
  • 53
0
votes
1 answer

multiple jQuery whens' dones?

I can pass in multiple ajax calls into a when like this: var dnldAy = []; for (i=0, iMax=urlsToLoad.length; i < iMax; i++) { dnldAy.push( $.ajax({ url: urlsToLoad[i], dataType: "json" }) ); } $.when.apply($, dnldAy).done(…
jedierikb
  • 12,752
  • 22
  • 95
  • 166
0
votes
1 answer

jQuery Deferred Queue not calling back

I'm having trouble getting a queue of deferred objects to call back when complete. As you can see in the following code, I'm creating a queue (as per this answer: JQuery - $.when syntax for array of Deferred objects) but the answer unfortunately…
0
votes
1 answer

Looping ajax calls using deferred and promises

I am new to jquery $.Deferred and it seems that I cannot understand a whole bunch of stuffs regarding async processing. Let say I wanna loop through usernames and login them, process something, and logout(this might not be necessary to include in…
Joey Hipolito
  • 3,108
  • 11
  • 44
  • 83
0
votes
1 answer

Continue loop after a function has finished executing. How to use jquery deffered

I have the following data var data = [{user:"somename"}, {user:"anothername"}]; I have this function that processes that that, let say checking user if it exist function process(user) { $.ajax({ url: 'http://domain.com/api', …
Joey Hipolito
  • 3,108
  • 11
  • 44
  • 83