Reputation: 17
i try to loading screen on php upload time, please help me
$con = mysqli_connect("localhost","user","password","db_name");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$current_date = date("h:i:sa");
$date_title = "TODAY";
$update_query1 = "insert into date(date_title, date) values('$date_title', '$current_date')";
if(mysqli_query($con,$update_query1)){
echo "<script>alert('Comments has been published')</script>";
echo "<script>window.open('load.php','_self')</script>";
}
Upvotes: 0
Views: 574
Reputation: 385
You can use the below code to show loader during submit the data
<form method="post" onsubmit="return showoverlay();">
<div id="overlay" hidden>
<i class="fa fa-spinner fa-spin spin-big"></i>
</div>
Your HTML Design Code here.
</form>
<script>
function showoverlay() {
$('#overlay').prop('hidden',false);
$('#overlay').css({"display": "table"});
}
</script>
May be this code is useful to you.
Upvotes: 2
Reputation: 394
The moment user clicks the upload button, display Loading...
in the screen. Once upload is successful change Loading...
to Success
.
Use AJAX.
Upvotes: 1