在php表单发布时加载进度条

I found a interesting article here, which has a progress bar within the button. I want to implement this while I post a data to php file from a html file.

To be specific, The loading animation should appear when I navigate from HTML to php page.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
    <form action="POST.php" method="POST">
        <input type="text">
        <input type="submit">
    </form>
</body>
</html>

You can use ajax:

$('#myform').submit(function() {
   $('#processing').show();
   $.ajax({url: 'form.php', data: $(this).serialize(), success:

   function(data) {
      // Process returned data
      $('#processing').hide();
                }});
 return false;
 });

Or instead of hide you can load image loading gif.