0

I am trying to get my progress bar to update with the actual PHP code when completed.

var url2 = '';
function progressBarSim(al) {

  var bar = document.getElementById('progressBar');
  var status = document.getElementById('status');
  status.innerHTML = al+"%";
  bar.value = al;
  al++;
  var elem = document.getElementById("progressBar"); 
  elem.style.width = al + '%'; 
  var sim = setTimeout("progressBarSim("+al+")",77);
    if(al == 100){
      status.innerHTML = "100%";
      bar.value = 100;
      clearTimeout(sim);
      var finalMessage = document.getElementById('finalMessage');

      finalMessage.innerHTML = "<?php include('hi.php'); ?>";
    }
}
var amountLoaded = 0;
progressBarSim(amountLoaded);

The above code works when I don't include PHP code inside my hi.php file but if I include any form of actual PHP code inside the file it will just make my entire progress bar not work anymore. How can I make my progress bar load hi.php when it's reached 100%?

Vinicius Cardoso
  • 666
  • 8
  • 23
Open
  • 105
  • 7
  • Possible duplicate of [What is the difference between client-side and server-side programming?](https://stackoverflow.com/questions/13840429/what-is-the-difference-between-client-side-and-server-side-programming) – misorude Aug 19 '19 at 07:45

1 Answers1

0

You cannot access files, located on server via client javascript. Moreover, all php scripts are running on server side.

UPD:

{

In your case you can do these things:

1)Load content that you want to show with other page - it's fit, if loading content does not vary.

2)Load content dynamically, using AJAX

}

If you want to load content dynamically, you should read about ajax queries.