title: jQuery ajax fetch data from PHP into a jQuery variable
body: <p>I need to receive the status of vote using ajax and php and jquery. Following is my code : </p>
  
  <pre><code>var VoteStatus= GetStatus() ;
  var ID = $('#ID').val();
  
  function GetStatus() {
      var res = '';
  
      $.ajax({
          type: "POST",
          data: {VoteID:ID} ,
          url: "/vote_status.php",
          async: false,       
          success: function(result) { res=result; } 
      });                  
  
      return res;
  }
  
  alert('Vote Status= ' + VoteStatus);
  </code></pre>
  
  <p>In my php file: </p>
  
  <pre><code>$VoteID = $_POST['VoteID'];
  $Property = $_POST['Property'];
  
  
  
  if ( $VoteID == 0 ) 
      echo 'No Vote provided - Property = '. $Property;
  
  exit;
  </code></pre>
  
  <p>The alert box shows: <strong>Vote Status = No Vote Provided</strong></p>
  
  <p>Please help.</p>
  
  <p>I have posted the VoteID, but the php file doesn't seem to receive it. </p>