title: Function returns Ajax response - Value is undefined? jQuery Ajax
body: <p>When I alert the returned value from the jsonServerResponse function, its value is undefined - despite JSON being returned from the process.php page.</p>
  
  <pre><code>function jsonServerResponse(operation, JSOoptionalData) {
          JSOoptionalData = (typeof JSOoptionalData == "undefined") ? 'defaultValue' : JSOoptionalData
          var jqxhr = $.ajax({
              type: "POST",
              url: "process.php",
              data: "apicommand=" + JSOoptionalData,
              success: function (json) {
                  return jQuery.parseJSON(json);
              }
          });
  }
  
  alert("Response as JS Object: "+jsonServerResponse("operation"));
  </code></pre>
  
  <p>I know that the problem is that the alert function made before the asynchronous request is complete, but I am unsure how to fix this problem. Any advice is really appreciated :)</p>