I want to return true or false depending of the result of an ajax jquery call,how I can make it an asynchronous call ,this I get a Promise object in pending state
   function codeExists(code){
    return Promise.resolve($.ajax({
      method: "GET",
      url: "ajax.php",
      data: { op:'codeExists', code: code }
    })
      .done(function( response ) {
        if(response == '1')
            return true;
        else
            return false;
      }));
}
