title: Get posted data using jquery
body: <p>I want to get posted data using jquery. I have implemen</p>
  
  <p>Html Form</p>
  
  <pre><code>      &lt;form  id="login_form" action="userPref.php" method="post" &gt;
  
        &lt;div hidden id="error" style="color:red; text-align:center;"   &gt; &lt;p&gt; user not found  &lt;/p&gt;   &lt;/div&gt;
          &lt;div class="form-group"&gt;
            &lt;label for="usrname"&gt;&lt;span class="glyphicon glyphicon-user "&gt;&lt;/span&gt; User Id&lt;/label&gt;
            &lt;input type="text" value="" class="form-control" required="required" id="usrname" name="usrname" placeholder="Enter User Id" &gt;
          &lt;/div&gt;
  
            &lt;button type="submit"  id="login" class="btn btn-success btn-block"&gt;&lt;span class="glyphicon glyphicon-off"&gt;&lt;/span&gt; Login&lt;/button&gt;
        &lt;/form&gt;
  </code></pre>
  
  <p>In userPref.php I am using php to get data but I actually want to use jquery</p>
  
  <pre><code>    var userid = &lt;?php echo $_POST["usrname"] ?&gt;;
  </code></pre>
  
  <p>I have also tried to access the form data using jquery but I was not able to access the data. Please help me.</p>