0

i want stop my script during my call ajax:

include "co.php";

include "infopagetransfert1.php";

include "senddatatransfert1.php";

?>

<script> 
     var content = $("body").html();
               $.post("infopagetransfert2.php", {
                  content: content,
               }).done(function (data) {
               });
</script>


<?php
sleep(10);
   $myfile = fopen("example_homepage2.txt", "r") or die("Unable to open file!");
   $test = fread($myfile, filesize("example_homepage2.txt"));


on my ajax i create the example_homepage2.txt, so i want stop the script during ajax and after do behind sleep 10

Thank guys

heimldall
  • 13
  • 3
  • 2
    PHP doesn't work that way, it's parsed before sending to the clients browser, which means that by the time the sleep has completed, the AJAX script has only just been sent to your screen. Why not get the contents of `example_homepage2.txt` returned in RESPONSE from your AJAX? – Barrie Dawson Apr 04 '22 at 22:36
  • Go have a read 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) – CBroe Apr 05 '22 at 07:07

1 Answers1

0

You can not. You can read PHP response data from ".done()" function and do the rest thing.

xforce
  • 13
  • 3