Function return true or false
HI sorry for english , i have a function with an ajax call ,this is my function :
- function controlla_valore(){
- var valore= form_clienti.valore.value;
- $.ajax({
- type: "POST",
- url: "../../common/ricerca_valore.php",
- data: "valore=" + valore ,
- dataType: "html",
- success: function(ret)
- {
- if(ret==1){
- return true;
- console.log(ret);
- }
- else{
- return false;
- console.log(ret);
- }
- },
- error: function()
- {
- alert("Chiamata fallita, si prega di riprovare...");
- }
- });
- }
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 ?