LoadFromURL will simplify as follows:

function LoadFromURL(url) {
    return $.get(url).then(function(text) {
        return LoadFromText(text);
    });
}


There may be issues you haven't considered ...

Like your original version, the process will tend to recurse indefinitely until the server returns an HTTP error. You would have a slight challenge in writing the server resource appropriately, especially if, as is probable, you need to access the finally delivered text. 

With a little more thought, you could deliver all text in such a way that "continue" or "complete" is indicated in the text itself, or in an HTTP response code. For example, you could use response code 202 ("Accepted") to indicate that the process is incomplete. 

I think this will work (with jQuery 1.5+) :

function LoadFromURL(url) {
    return $.get(url).then(function(text, textStatus, jqXHR) {
        if(jqXHR.status === 202) {//continue
            return LoadFromText(text);
        }
        else {//complete
            return text;
        }
    });
}


You just need to arrange for the server to return 202 for "continue" or 200 for "complete".

Thus, LoadFromURL() could be called as follows :

LoadFromURL('my/resource').then(function(text) {
    console.log("After a series of $.get requests, the finally delivered text was:\n" + text);
});


Chaining deferreds

  Possible Duplicate:
  Does Downshifting (Engine Braking) Cause Extra Wear and Tear?  




Edit: As mentioned in the comments: Duplicate of Does Downshifting (Engine Braking) Cause Extra Wear and Tear?

Many people, it seems, use the motor brake to slow down the car, often when they want to bring it to a complete standstill, e. g. in front of a red light. Depress clutch, shift to a lower gear, engage clutches slowly while letting the engine run at idle speed. Others - including me - let go the accelerator, use the (little) breaking effect excerted by the engine, and eventually just depress the clutch and use the brakes to bring the car to a standstill.

Note that I'm not talking about downshifting at the beginning of a long descent, where continuous braking will let the brakes run hot.

The reason given for the clutch maneuver is that this saves the brakes from wear. But it also puts more wear on the clutch, and possibly on the transmission.

Given the price of a new clutch and that of a new set of brake pads, I'd rather have the latter replaced. And compared to how often I have to use the brakes anyway, it can't be all too much that I save.

Is there any firm advice on this question? Assuming a reasonably recent car, of course - maybe this used to be an issue some decades ago.
