Questions tagged [.when]

.when is a jQuery function for executing a function when the included AJAX request(s) have been completed. It usually precedes .then.

.when is a jQuery function for executing a function when the included AJAX request(s) have been completed. It usually precedes .then. An example of a usage would be:

$.when($.post(foo1), $.post(foo2)).then(function (a, b) {
  /*
    execute this when requests to foo1 and foo2 have been made. a[0] and b[0] contain
    the results returned by the two pages foo1 and foo2.
  */
});

Documentation

174 questions
0
votes
1 answer

deferred for chaining ajax wont work

I wanna using $.deferred objects to handle my recursive function's requests. but here I have a problem that $.when wont wait for call1 success then do call2! it wont send the returned data from call1 to call2 function! note : only want to…
m mov
  • 99
  • 1
  • 6
0
votes
3 answers

jQuery execute after 3 AJAX calls and loops are done

var request3 = window.SendAjax(window.siteRoot + "Home/GetTweets", "{}", function(msg) { //tweet $.each(msg, function(i, value) { ... }); console.log("loop done"); }); $.when(request1, request3).then(function () { …
Mark
  • 2,543
  • 6
  • 33
  • 44
0
votes
3 answers

ajax complete function invoking after dom is ready

I need to make an ajax request and then process some data returned from server. I'd like to make this request earlier then document is ready. But i will be able to process data only after document is ready. I've got an idea to make something like…
-1
votes
1 answer

Get value from another static table when "ID_ENTE_COMPETENZA_TIPO" is equal to 'S' in an dataframe

i have a simple dataframe like: df id_ente_competenza_tipo | INOLTRO_PSAP2 3 S 3 S 3 N 2 S i have another…
Catanzaro
  • 1,312
  • 2
  • 13
  • 24
-1
votes
1 answer

Waiting until all ajax calls are finished not working with $.when

I'm trying to call a function once after all ajax calls are done. The $.when below is being called too soon with an empty array of promises. searchRecommendations() is being called several times from the success of a few previous $.ajax calls. …
Squirrl
  • 4,909
  • 9
  • 47
  • 85
-1
votes
1 answer

Gecoding addresses through Google maps api and deferring the results

I am using Google's maps API to geocode two addresses. I defer the returned results and use a $.when().then() method to execute my logic once I get the coordinates for the string addresses. The problem is the API always returns the result as…
-1
votes
1 answer

Using function .when jQuery in "Javascript"

I am new to jQuery $.When. I am trying to fill a textbox after another textbox be filling