How to disable submit button AFTER form submission?

How to disable submit button AFTER form submission?

Everywhere proposed solution
  1. $('form').submit(function() {
  2.       $(":submit").attr("disabled", "disabled");
  3. });

doesn't work for me, because in that case the button name and value won't be included in the request to the server (because the button is disabled), and I've got a situation where I need to know which button was clicked to submit the form.

Is there any way to disable the submit button AFTER the form submission, so it would be included in the request?