title: jQuery $.ajax success must be a callback function?
body: <p>I've created a wrapper function for jQuery's $.ajax() method so I can pass different dataTypes and post variables - like so:</p>
  
  <pre><code>function doPost(dType, postData, uri){
  
      $.ajax({
          url: SITE_URL + uri,
          dataType: dType,
          data: postData,
          success: function(data){
            return data;
          });
  }
  </code></pre>
  
  <p>The problem I'm having is getting the data (which is always JSON) back out.  I've tried setting a <code>var ret</code> before the $.ajax() function call and setting it as <code>ret = data</code> in the success function.  Am I being stupid about this?  If I don't set a success function, will the $.ajax simply return the data?  Or is it just <code>success: return data</code>?  Or does <code>success</code> require a callback function to handle the data, which could just be <code>return data</code>?</p>