在form =“action”调用的警告框中显示PHP函数的输出

Basically, i'm using a <form action=MyPhp.php> to upload a file from the client to my server. When the upload is successfull (or not), i send back a message to the client to show the result (success or failed).

Here is the trick : i don't know how to catch that message. If it was only javascript/php i would use XMLHttpRequest(), but i think it can be way easier. I already checked the parameter "onsubmit=" and "target=", but i don't know how to access to the message. My goal would be to show the message as a javascript:alert("The message from php"). Any suggestions would be appreciated. Here is my code:

HTML

<form action="Upload.php" method="post" enctype="multipart/form-data">
    <div class="custom-button-style browse-button-style" onclick="Browse()">Browse part</div>
    <input class="toHide" type="file" id="fileToUpload" name="fileToUpload" data-role="none"/>
    <input class="toHide" type="submit" value="Upload Part" id="submit" name="submit"  data-role="none"/>
</form>

PHP

<?php
$target_dir = "upload/";
$target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
$uploadOk = 1;
$imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);

if($imageFileType != "zip" )
{
    echo "The file selected doesn't have the right extension. Please select a .zip file.";
    $uploadOk = 0;
}

if($uploadOk == 1)
{
    if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file))
    {
        $zip = new ZipArchive();
        $res = $zip->open($target_file);
        if($res == TRUE)
        {
            $zip->extractTo($target_dir);
            $zip->close();
            unlink($target_file);
            echo "The file ". basename( $_FILES["fileToUpload"]["name"]). " has been uploaded.";
        }
    } 
    else 
    {
        echo "Sorry, there was an error uploading your file.";
    }
}
else
{
    echo "Sorry, your file was not uploaded.";
} 
?> 

you coud try something like this:

  echo "<script language='JavaScript' type='text/javascript'>";
     echo "alert('your message');";
  echo "</script>";