Function return true or false

Function return true or false

HI sorry for english , i have a function with an ajax call ,this is my function :

  1. function controlla_valore(){
  2.     var valore= form_clienti.valore.value;
  3.     $.ajax({
  4.       type: "POST",
  5.       url: "../../common/ricerca_valore.php",
  6.       data: "valore=" + valore ,
  7.       dataType: "html",
  8.       success: function(ret)
  9.       {
  10.         if(ret==1){
  11.           return true;
  12.           console.log(ret);
  13.         }
  14.         else{
  15.            return false;
  16.            console.log(ret);
  17.         }
  18.       },
  19.       error: function()
  20.       {
  21.         alert("Chiamata fallita, si prega di riprovare...");
  22.       }
  23.     });
  24. }
In my php code i search the value in db if ther'is a row , return 1 else return 0.

I want return true or false dependingon this value but if i isert return false (or return true ) i have the alert "chiamata fallita...) .

If i delete return true or false , in console i see the ret .

How can i solve ?