I am using send.php to which the form is transmitted and send to the specified mail address.

After sending the mail, the php file triggers the JS code included in this PHP filem which alerts the user that mail was sent and also using Javascript redirect the user to home page.

The code is here:

	 echo '<script type="text/javascript">
               window.location = ".../index.html";
			   alert("Comment was submitted");
So the user gets alert than is redirected to homepage.
However I intend to get another result: first redirect the user to homepage and then get the alert window. changing the order of commands does not help. can someone help me with this issue?