How to load a bar within a Javascript load() bar?

Asked

Viewed 552 times

1

I own a php page index php. that at first loads another php page php page. with a load():

$("#div").load('pagina.php');

On this page I have a loop For with a time consuming sql and I have to show the progress of this query. The problem is that this page is only loaded in the div after the end of the query.

There is a way for me to bring a load with the progress of the page database php page. into this javascript that first loads on the page index php. ? For example:

$('#div').html("Carregando...");
$("#div").load('pagina.php');

But instead of the "Loading" message, I need to show some progress.

Thank you.

  • With progress you speak from 0% to 100%?

  • It can be 0% to 100% or split. I just need an estimate that the page is making progress.

1 answer

1


Follow the example below:

<html>
<style>
div#loading {
  width: 100%;
  height: 100%;
  display: table;
  background-color: rgba(0,0,0,0.5);
  position: fixed;
  z-index: 9999;
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<body style="margin: 0;">
<div id="loading">
	<div style="background:url('http://loading.io/assets/img/default-loader.gif') no-repeat center center;width:50px;height:50px;display: table-cell;"></div>
</div>
<!--

COLOCA AQUI O CORPO DA PAGINA

-->
<script>$(document).ready(function() { $('div#loading').fadeOut() });</script>
</body>
</html>

You can change style of loading and between a website http://loading.io

  • Very good, I would use the PAC MAN of Loading.

  • I put the code for you. see more

Browser other questions tagged

You are not signed in. Login or sign up in order to post.