title: How to call a JS function in PHP file
body: <p>I have a project where I can upload a specific excel-file on a website. The excel-file is shown on the website as a html table. Under the table is a button to upload the table in a database. Therefore I save the table cells in an array (in JS-function). At the end I pass the array to a second php-file, where I upload the array data in a database. 
  On last upload I want to show a pop-up.
  I have these files:</p>
  
  <p>upload.php</p>
  
  <pre class="lang-php prettyprint-override"><code>if (isset($_FILES['file']) &amp;&amp; !empty($_FILES['file'])) {
      //show excel file as table on website
      &lt;form  action="&lt;?php echo $_SERVER['PHP_SELF']; ?&gt;" method="POST" enctype="multipart/form-data"&gt;
         &lt;button id="exBtnHoch" name="exBtnHoch" onclick="saveInArray()" type="button"  class="btn btn-success btn-block"&gt;Excel-Datei hochladen&lt;/button&gt;
         &lt;/br&gt;&lt;/br&gt;&lt;/br&gt;&lt;/br&gt;&lt;/br&gt;&lt;/br&gt;  
      &lt;/form&gt;
  }
  </code></pre>
  
  <p>excelEinlesen.php</p>
  
  <pre class="lang-php prettyprint-override"><code>include "pop_up.php";
  
  if(isset($_POST['daten'])){    //checks if array is passed
      //if successfull then do something like:
      echo '&lt;script type="text/javascript"&gt;showPOP_UP();&lt;/script&gt;';
  }
  //EDIT
  function a (){}      //they are called in the if-part
  
  function b (){}
  </code></pre>
  
  <p>EDIT: pop_up.php: HTML-Code</p>
  
  <pre class="lang-php prettyprint-override"><code>&lt;!doctype html&gt;
  &lt;html lang="de"&gt;
      &lt;head&gt;
          &lt;!-- Required meta tags --&gt;
          &lt;meta charset="utf-8"&gt;
          &lt;meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"&gt;
  
          &lt;!-- Bootstrap CSS --&gt;
          &lt;link rel="stylesheet" href="../css/bootstrap.min.css"&gt;
          &lt;script type="text/javascript" src="js/excelEinlesen.js"&gt;&lt;/script&gt;
      &lt;/head&gt;
      &lt;body&gt;
      &lt;div class="modal fade" id="pop_upHochgeladen" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="false"&gt;
          &lt;div class="modal-dialog" role="document"&gt;
              &lt;div class="modal-content"&gt;
                  &lt;div class="modal-header"&gt;
                      &lt;h5 class="modal-title" id="exampleModalLabel"&gt;Speichern&lt;/h5&gt;
                      &lt;button type="button" class="close" data-dismiss="modal" aria-label="Close"&gt;
                          &lt;span aria-hidden="true"&gt;&amp;times;&lt;/span&gt;
                      &lt;/button&gt;
                  &lt;/div&gt;
              &lt;div class="modal-body"&gt;
                  Die Daten des Mitarbeiters wurden erfolgreich in die Datenbank geschrieben.
              &lt;/div&gt;
              &lt;div class="modal-footer"&gt;
                  &lt;button type="button" class="btn btn-warning" onClick="geheZuHome()"&gt;Zurück zur Startseite&lt;/button&gt;
                  &lt;button type="button" class="btn btn-warning" onClick="window.location.href=window.location.href"&gt;Weitere Datei hochladen&lt;/button&gt;
              &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>AND</p>
  
  <p>excelEinlesen.js</p>
  
  <pre class="lang-js prettyprint-override"><code>function saveInArray(){
      //save table cells in array
      //at the end pass array to excelEinlesen.php
  }
  
  function showPOP_UP(){
      $('#pop_up').modal('show');   
  }
  </code></pre>
  
  <p>I tried to echo it and searched the whole internet without any satisfying solutions.
  First had a second onclick in upload.php and it worked, but I want to call the JS-function in a specific case without onclick.</p>
  
  <p>I don't know if this a problem, but I have different folders for my files: "js" and "php".</p>