title: How to increment a progress bar while inserting data into database on button click in php
body: <p>I have tried doing this but couldn't get it. Below is my code :</p>
  
  <pre><code>&lt;script&gt; 
      $(document).ready(function(){
          var $progressbar = $("#progressbar");
          $progressbar.show();
          $('#uploadForm').on('submit', function(e){
              e.preventDefault();
              $(function(){
                  $progressbar.css('width', '30%');
              }); 
              $.ajax({
                  url: "insertdata.php",
                  type: "POST",
                  data: new FormData(this),
                  contentType: false,
                  processData: false,
                  success: function(data){
                      console.log(data);
                      if (data == 'T'){
                          $('#txtname').val("");
                          $('#txtsex').val("");
                          $('#txtage').val("");
                          $('#txterr').val('Record Inserted');
                          $progressbar.css('width', '100%');
                      }
                  },
                  error: function(data){
                  alert("Something went wrong !");
              }
          });
      });
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>Code for Progress bar is as follows:</p>
  
  <pre><code>&lt;div class="progress" style="margin-top:100px"&gt;
      &lt;div class="progress-bar active" id="progressbar" role="progressbar" aria-valuenow="45" aria-valuemin="0" aria-valuemax="100" style="width: 0%"&gt;
          &lt;span class="sr-only"&gt;0% Complete&lt;/span&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>insertdata.php</strong>
  In this file, data insertion is processed.</p>
  
  <p>Here working of my code is something like this: when the user presses the "Submit" button, progress bar shows 30% increase and when the process finishes 30% moves to 100%.</p>
  
  <p>What I want to achieve is : Progress Bar should show progress ( percent by percent ) with the insertion of data into database, after Submit button is pressed.</p>
  
  <p>How to achieve this?</p>
  
  <p>Please help</p>