Chaining ajax requests with jQuery's deferred
问题 I have a web app which must call the server multiple times. So far, I had a long nested callback chain; but I would like to use jQuery's when , then etc. functionality. However, I can't seem to get stuff running again after using a then . $ .when ($.get('pages/run-tool.html')) .then (function (args) { // This works fine alert(args); $('#content').replaceWith (args); $('#progress-bar').progressbar ({value: 0}); }) .then ($.get('pages/test.html')) .done (function(args) { // This prints the same