Q:

$.post followed by form.submit seems to cancel the $.post

On a web application with multiple forms on it, if you click an option that moves to another page, we save any unsaved content by calling $.post(window.location.pathname, options, saveReturn, 'json'); and then go to the new page by setting some parameters and calling form.submit();.   This normally works fine, but on our customer's production server (but not their test servers, of course), the actions of the $.post don't seem to happen - the stuff that's supposed to be saved to the database aren't saved.   I've got one of our customer tech support people to run a firebug session, and the POST that is triggered by the $.post command is shown in red, and there is no "Response" header. 
Is there some sort of race condition caused by us leaving the page before the POST completes?   Is there some way to wait for the POST to complete, short of making the saveReturn function be responsible for the form.submit()?   I'd rather not add that functionality to saveReturn because this same $.post call is done if they manually save their work using the "Save" button. 

A:

Your intuition seems to be right.   If you want to separate saveReturn from form.submit "more" you could attach form.submit to the complete event of the request:
$.post(window.location.pathname, options). 
    success(saveReturn). 
    complete(function(){
        form.submit();
    });

This is kind of nice because it clearly separates the two actions (assuming of course that you want to; that seems to be what you want given your question).