.then(function(json1){
return json1
})
This is an unnecessary (almost) identification code.
.then(function(json1){
…;
You should always returnfrom the callback thenso that the new promise gets the value. You can even return promises to be "deployed"!
Should I be nested. then statements to each other?
, , promises. "", , . json1, .
, .
return , , then.
$.getJSON('http://www.json1.com').then(function(json1){
return $.getJSON('http://www.json2.com').then(function(json2){
return {one: json1, two: json2};
})
}).then(function(both) {
});