Okay, so it could probably be me missing something important, but as far as I know AJAX is asynchronous.
When a user registers for my Website, he shall be directed to a success-site while in the background a registration-mail is sent.
The code I came up with looks as follows:
$.ajax({
cache: false,
async: true,
type: "POST",
url: "/Account/SendRegistrationMail",
data: { //someDataNeededByController},
success: function() {
console.log("fire and ice");
}
});
window.location.href = "/Account/RegistrierenErfolgreich";
Nevertheless the user is being redirected after the mail has been sent: https://i.stack.imgur.com/h1O8A.png