title: passing data to php using ajax
body: <p>this is not my first time to use ajax on my website
  but right now im really confused whats wrong with it. 
  i even removed the important codes. what im doing right now. is to check if ajax is passing the data to the php or not. </p>
  
  <pre><code> &lt;script type='text/javascript'&gt;
          $(document).ready(function () {
              $('.btndeclineme').click(function () {
                      var docreason = document.getElementById("docreason");
                      if (docreason !== null &amp;&amp; docreason.value === "")
                      {
                        $('#reasonalert').show();
                        return;
                      }else{
                          var signatoryidglobal = JSON.parse('&lt;?php echo json_encode($_SESSION['signatoryid']); ?&gt;');
                          alert(signatoryidglobal);
  
                          $('#reasonalert').hide();
  
                                  $.ajax({
                                          type: "POST",
                                          url: "sample.php",
                                          data: ({dtsignatory: signatoryidglobal})
                                      })
                                      .done(function (msg) {
                                      alert( "Data:" + msg);
  
                                      })
                              .fail(function() {
                                  alert( "Posting failed." );
                              }); 
                      };
              });
          });
    &lt;/script&gt;
  </code></pre>
  
  <p>and this is the sample.php</p>
  
  <pre><code>&lt;?php 
  
      $temp1 = $_POST['dtsignatory'];
  
  echo $temp1;
  
  ?&gt;
  </code></pre>
  
  <p>my problem is its not showing errors. isn't it supposed to promp the data i passed to the php because of alert( "Data:" + msg); but it keeps showing nothing.</p>
  
  <p>i even add a alert prompt to check if the variable has a value. and it has a value.  sorry for my bad english. i hope my question is clear</p>