title: retrieve the result of an ajax request as a variable
body: <p>How can I get the result of my ajax post into a variable:</p>
  
  <pre><code>function decode_original(hshdecode) {   
      var decode_original = 'decode=1&amp;hashvalue=kjh4k5hq35l&amp;hashkey=12345';
      $.ajax({
              type: "POST",
              async: false,
              contentType: "application/x-www-form-urlencoded; charset=utf-8",
              url: 'decode_function.php',
              data: decode_original,
              cache: false,
              success: function(return_value) {
                      var decoded_value = return_value;
                      console.log("Decoded Value:" +decoded_value);   
                      return decoded_value;
              },
              error: function(data){
                      return data;
              }
          });     
  }
  </code></pre>
  
  <p>The above actually gets the return value successfully, but I am unable to pass the result into a variable:</p>
  
  <pre><code>var decode_value = decode_original(encoded_value);
          alert(decode_value);
  </code></pre>