title: function that return a value from ajax call request
body: <p>I want a function that returns a value from an ajax request. I want to stop javascript execution until the function get its value which is return by ajax asynchronous request.
  Something like:</p>
  
  <pre><code>function myFunction() {
      var data;
      $.ajax({
          url: 'url',
          data: 'data to send',
          success: function (resp) {
              data = resp;
          },
          error: function () {}
      }); // ajax asynchronus request 
      return data; // return data from the ajax request
  }
  </code></pre>