title: PHP ob_end_flush with JQuery
body: <p>I am having an issue with ob_implicit_flush with jquery.  I am using a jqueryUI widget tabs to show 2 tabbed forms.  In my process I am printing the live output of an ant task.  The code for that is as follows</p>
  
  <pre><code>if (isset($cleaned)){
      echo '&lt;div id="ant"&gt;';
      $json_arg = escapeshellarg($cleaned);
      while (@ob_end_flush());
      ob_implicit_flush(true);
      $proc = popen("sudo /var/www/html/scripts/set_vars.sh $json_arg 2&gt;&amp;1", 'r');
      echo '&lt;pre&gt;';
      while (!feof($proc)){
          echo fread($proc, 4096);
          @ flush();
      }
      echo '&lt;/pre&gt;';
      echo '&lt;/div&gt;';
      echo '&lt;script&gt;';
      echo 'setTimeout( function ( ) { alert( "Event Added!" ); }, 2000 );';
      echo 'clearform();';
      echo '&lt;/script&gt;';
  }
  </code></pre>
  
  <p>It works fine but when the ob_end_flush is called all the form stylings are also flushed (created by jquery).  Once the task is complete the stylings return.  Does any one know how to avoid I guess jquery while this task is running?</p>
  
  <p>Thanks</p>
  
  <p>Edit:</p>
  
  <p>Here is the full code</p>
  
  <pre><code>        &lt;html&gt;
              &lt;head&gt;
                  &lt;link rel="stylesheet" href="css/jquery-ui.css"&gt;
                  &lt;link rel="stylesheet" type="text/css" href="css/style.css"/&gt;
                  &lt;script src="scripts/jquery-ui.min.js"&gt;&lt;/script&gt;
                  &lt;script src="scripts/jquery-ui.js"&gt;&lt;/script&gt;
                  &lt;script language="javascript"&gt;
                      function clearform() {
                          document.getElementById("json").value="";
                      }
                  &lt;/script&gt;
                  &lt;script&gt;
                      $(function() {
                          $( "#tabs" ).tabs();
                      });
                  &lt;/script&gt;
                  &lt;title&gt;Add Manual Event Data&lt;/title&gt;
                  &lt;?php
                      if (empty($_POST["comment"])) {
                          $comment = "";
                      }
                      else {
                          $cleaned = test_input($_POST["comment"]);
                          $comment = ($_POST["comment"]);
                      }
  
                      function test_input($data) {
                          $data = trim($data);
                          $data = addslashes($data);
                          return $data;
                      }
                  ?&gt;
              &lt;/head&gt;
              &lt;body&gt;
                  &lt;div id="tabs" class="body-check"&gt;
                      &lt;ul&gt;
                          &lt;li&gt;&lt;a href="#tabs-1"&gt;Event By String&lt;/a&gt;&lt;/li&gt;
                          &lt;li&gt;&lt;a href="#tabs-2"&gt;Add Event Form&lt;/a&gt;&lt;/li&gt;
                      &lt;/ul&gt;
                      &lt;div id="tabs-1"&gt;
                          &lt;form method="post" action="&lt;?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?&gt;"&gt;
                              &lt;center&gt;&lt;h1&gt;Add Event Data:&lt;/h1&gt;&lt;/center&gt;
                              &lt;p&gt;
                                  &lt;textarea id="json" name="comment"&gt;&lt;?php echo $comment;?&gt;&lt;/textarea&gt;
                              &lt;/p&gt;
                              &lt;input type="submit" name="submit" value="Submit"&gt;
                          &lt;/form&gt;
                          &lt;?php
                              if (isset($cleaned)){
                                  echo '&lt;div id="ant"&gt;';
                                  $json_arg = escapeshellarg($cleaned);
                                  while (@ob_end_flush());
                                  ob_implicit_flush(true);
                                  $proc = popen("sudo /var/www/html/scripts/set_vars.sh $json_arg 2&gt;&amp;1", 'r');
                                  echo '&lt;pre&gt;';
                                  while (!feof($proc)){
                                      echo fread($proc, 4096);
                                      @ flush();
                                  }
                                  echo '&lt;/pre&gt;';
                                  echo '&lt;/div&gt;';
                                  echo '&lt;script&gt;';
                                  echo 'setTimeout( function ( ) { alert( "Event Added!" ); }, 2000 );';
                                  echo 'clearform();';
                                  echo '&lt;/script&gt;';
                              }
                          ?&gt;
                      &lt;/div&gt;
                      &lt;div id="tabs-2"&gt;
                          &lt;h1&gt;Hello!&lt;/h2&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/body&gt;
          &lt;/html&gt;
  </code></pre>
  
  <p>Thanks</p>