How to let animation play before restarting level

In my character script, there is a reference to the object’s animator, called anim. this plays every animation relevant to the player (walk, jump, idle). however, i can set

   anim.SetBool("isdead", true);

in the function to respawn, but it just reloads the level and i want it to wait first.

currently my respawn looks like this

    anim.SetBool("isdead", true);
	Application.LoadLevel(Application.loadedLevelName);
	anim.SetBool("isdead", false);

how do i make it wait until animation is done before restarting level?

You can use animation.isPlaying to check if the animation is still playing or you can make the animation send an event on its last frame.