title: Wait until jquery ajax request is done and return value
body: <p>I want to wait until ajax call complete and return the value.</p>
  
  <pre><code>function isFileExists(url) {
      var res = false;
      $.ajax({
          type: "GET",
          async: false,
          url: url,
          crossDomain: true,
          dataType: "script",
          success: function () {
              res = true;
          },
          error: function () {
              res = error;
          },
          complete: function () {
  
          }
      });
      return res; //It is always return false
  }
  </code></pre>
  
  <p>I want to return the value "true/error"</p>
  
  <p>Please help me.</p>