title: jquery set ajax result to an outside variable callback
body: <p>I need to set a variable to the results of an ajax query. I realise that i cannot just return result in the success function as this is an asynchronous call. but would like to achieve this will a callback function and not set to a synchronous call.</p>
  
  <p>I would like to achieve something like:</p>
  
  <pre><code>myMethod: function() {
     var result = function(callback) {
        this.getResults(params)
     }
  },
  
  getResults: function(params) {
     $.ajax({
        type: 'GET',
        url: 'some/url',
        data: params,
        success: function(data) {
           callback(data).call();
        }
     });
  }
  </code></pre>
  
  <p>Where result = data</p>
  
  <p>I know my syntax is not right, I have tried so many variations and havent found something that works. Any help would be soooooo appreciated. Thank-you!</p>