title: How to load php file with JS code
body: <p>Since I am new to JS coding and web designing, I have a following doubt:</p>
  
  <p>I have one html page which has onclick function for form text area. If text area remains empty and user clicks submit, it should display message to enter entry and if entry is right one the corresponding file should get open. I have if/else condition in JS file, which is giving appropriate message while text area remains empty but not loading file which I am mentioning when entry is not empty.</p>
  
  <p>Below is the html snippet:</p>
  
  <pre><code>&lt;!DOCTYPE HTML&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
      &lt;meta charset=utf-8&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;form name="drugform" action="#"&gt;
          &lt;pre&gt; Drug Name&lt;input type="text" name="name1" value="" /&gt;&lt;/pre&gt;
          &lt;/p&gt;
  
          &lt;input type="button" value="Enter" onclick='buttoncheck()' /&gt;
      &lt;/form&gt;
      &lt;script type="text/javascript" src="if-else-button.js"&gt;&lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>and JS code is:</p>
  
  <pre><code>function buttoncheck() {
      if (Boolean(document.drugform.name1.value)) {
          load(form1.php);
      } else {
          alert('Enter Drug name');
      }
  }
  </code></pre>
  
  <p>How to load file with js code (mentioned in if condition)?</p>