title: Submit Form Without Reloading Page and Get Output [PHP, jQuery]
body: <p>Hellow,
  I've been trying to submit a form without reloading and getting PHP output on the same page. The main objective is to submit the form values to a PHP file and get the output sent by the PHP file.
  To understand it better, let's take a look on following code snippet:
  HTML &amp; jQuery Code:</p>
  
  <pre><code>&lt;html&gt;
    &lt;head&gt;
      &lt;script src="//code.jquery.com/jquery-1.9.1.js"&gt;&lt;/script&gt;
      &lt;script&gt;
        $(function () {
  
          $('form').on('submit', function (e) {
  
            e.preventDefault();
  
            $.ajax({
              type: 'post',
              url: 'on.php',
              data: $('form').serialize(),
              success: function () {
                alert('form was submitted');
              }
            });
  
          });
  
        });
      &lt;/script&gt;
    &lt;/head&gt;
    &lt;body&gt;
      &lt;form&gt;
        &lt;input id="name" name="name"&gt;&lt;br&gt;
        &lt;input name="submit" type="submit" value="Submit"&gt;
      &lt;/form&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>PHP Code:</p>
  
  <pre><code>&lt;?php
  if (isset($_POST['submit'])){
  $name=$_POST['name'];
  if($name == 'Johny'){
      echo "Welcome Johny";
  }
  else{
  echo "I Dont Know You";
  }
  }
  ?&gt;
  </code></pre>
  
  <p>What I Want:</p>
  
  <ul>
  <li>When user enter value in the Input box and submit it, the page should display output value e.g ECHO value without reloading the webpage.</li>
  </ul>