php - Refresh page automatically after submitting form -


after submit data form don't see immediate on screen, have refresh via browser refresh button.

<form action="" method="post">    <input type="submit" name="submit"  > 

i using settimeout function gave me lot of issues in submitting database , retrieving it. not debug properly, , removed function. without settimeout, able store in database , retrieve via refresh button. how make auto refresh?

i have done of jquery , ajax without refresh , page loading html file ajax

<html>     <head>     <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>     <script type="text/javascript">         $(document).ready(function(){              $("#sub").click(function(){                  $.ajax({                             url: 'dbadd.php',                             type: 'post',                             data: {naam:$("#nm").val()},                             success:function(response){                                 $("#d1").html(response)                             }                         });             });          });     </script>     </head>     <form method="post">           name : <input type="text" id="nm" name="name">         <div id="d1"></div>     <input type="button" name="submit" id="sub" value="submit">     </form>     </html> 

php file : adddb.php

<?php     $con=mysql_connect("localhost","root");     mysql_select_db("empl",$con);     $q=mysql_query("insert emp(name) values ('".$_post['naam']."')");     $qq=mysql_query("select name emp name='".$_post['naam']."'");     while ($data=mysql_fetch_object($qq)) {         echo $data->name;      } ?> 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -