title: Refresh a page with a time period
body: <p>I have some jQuery code to insert record in database. I need to reload the page within a time period. That means, when I click submit button, success message or error message will show first, and then the page will be reloaded after 5seconds.</p>
  
  <p>My code:</p>
  
  <pre><code>(function($){        
      $(document).ready(function(){
          $("#submit").click(function(){
              //alert("testing2.....")
              var num = /^[0-9]/;
              var date=$("#date").val();//alert(date);
              var sMan=$("#sMan").val();//alert(pType);
              var cName=$("#cName").val();
              var input_type=$("#input_type").val();
              var tamt=$("#tamt").val();
              var tpaid=$("#tpaid").val();
  
              //use the $.post() method to call insert.php file.. this is the ajax request
              $.post('action/b_payment.php', {
                  date: date,
                  sMan: sMan,
                  cName: cName,
                  input_type: input_type,
                  tamt: tamt,
                  tpaid :tpaid
              },
              function(data){
                  $("#message").html(data);
                  $("#submit").attr('disabled','disabled');
                  $("#message").hide();
                  $("#message").fadeIn(1500); //Fade in the data given by the insert.php file
                  $( '#formId' ).each(function(){ //This code is for reload the page
                      window.location.reload(true);
                  });
              });
              return false;
          });
      });
  })(jQuery);
  </code></pre>
  
  <p>How can I display the message after a time period 5 seconds?</p>