1.

What does hover() function do in jQuery?

Answer»

If you have to call several functions that return promises and take an ACTION only when all are completed then $.when can be used. It provides a way to EXECUTE callback functions based on zero or more Thenable objects, usually DEFERRED objects that represent asynchronous events.

The following is the syntax:

jQuery.when(deferreds);

Look at the following example:

ar promises = [    $.ajax('http://google.com'),    $.ajax('http://yahoo.com'),    $.ajax('http://www.nytimes.com') ]; $.when.apply($, promises).then(    function(result1, result2, result3){        console.log('All URLs fetched.'); } );

The ARGUMENTS passed to the thenCallbacks PROVIDE the resolved values for each of the Deferreds and matches the order the Deferreds were passed to jQuery.when().



Discussion

No Comment Found