title: Posting data to same page with jquery
body: <p>I have a phtml file. In file i have written some html in which there are some inputs and a button. In javascript i am validating the inputs and then posting using jquery like that </p>
  
  <pre><code>url = document.URL;    
  $.post(url, { name: "John", time: "2pm" } );
  </code></pre>
  
  <p>Then in the same page i have written some php to get the data like that,</p>
  
  <pre><code>&lt;?php
  if(isset($_POST['name'])) {
      $name = $_POST["name"];
      $time = $_POST["time"];
  }
  ?&gt;
  </code></pre>
  
  <p>Am i doing right? </p>