Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can we echo data for Progress bar in PHP?
    text
    copied!<p>We are working on a ProgressBar using Jquery UI. We are facing some problems, that we aren't getting values from PHP. We are unable to make a numerical loop that can return the value to Ajax based code. </p> <p>Below is our code: </p> <p><strong>HTML</strong></p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/&gt; &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"&gt;&lt;/script&gt; &lt;script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"&gt;&lt;/script&gt; &lt;style type="text/css"&gt; #bardivs { width:400px; /* or whatever the of the porgress bar is */ /* The position of #bardivs must be something other than static (the default) so that its children will be positioned relative to it. */ position:relative; } #progresstext { position:absolute; top:0; left:0; } &lt;/style&gt; &lt;script&gt; var url = "http://localhost/sample/data.php"; $(function() { var progress = 0; //alert("some value" + value, value); $("#progressbar").progressbar({ progress: 0 }); setTimeout(updateProgress, 500); }); function updateProgress() { var progress; $.get(url, function(data) { // data contains whatever that page returns if (data &lt; 100) { $("#progressbar").progressbar("option", "value", data); $("#progresstext").html("&lt;p&gt; Loading...&lt;p&gt;"); setTimeout(updateProgress, 500); } else { $("#progressbar") .progressbar("option", "value", 100); } }); } &lt;/script&gt; &lt;/head&gt; &lt;div id="bardivs"&gt; &lt;div id="progressbar"&gt;&lt;/div&gt; &lt;div id="progresstext"&gt;&lt;/div&gt; &lt;/div&gt; &lt;/html&gt; </code></pre> <p>We don't have any idea how can we make the code in PHP use this loading function. It should in a loop. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload