What are Deferred objects and promises in jQuery?
{ "n": 1 }
{ "n": 2 }
<p>Page</p>
$.when($.getJSON('a.json'), $.getJSON('b.json')).done(function (a, b) {
console.log('Sum: ' + (a[0].n + b[0].n));
});
Console output
Sum: 3
Learn more about the similar topics:
| Tutorials |
|---|
| No Content Found. |
| Exercises & Assignments |
|---|
| No Content Found. |
| Interview Questions & Answers |
|---|
| No Content Found. |