Guest User

Untitled

a guest
Feb 17th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. function funcao(valor) {
  2. var a;
  3. $.getJSON(/* aqui retorno de uma WebService*/, function (dados) {
  4. if ("error" in dados) {
  5. a = 0; //seria o true e false, mas não funcionaram também
  6. return a;
  7. } else {
  8. /* se o WS está ok faz algo e então seria true */
  9. a = 1;
  10. return a;
  11. }
  12. });
  13. }
  14.  
  15. return true;
  16. return 1;
  17. return "true";
  18. return 'true';
  19. return a.val();
  20. return a.value;
  21. return a;
  22. return !!a;
  23.  
  24. function valida(){
  25. if(funcao(dados)){
  26. faz algo
  27. } else if(funcao(dados)){
  28. algo
  29. }else{
  30. algo
  31. }
  32. }
  33.  
  34. if(func(dados)){}
  35. if(func(dados) == true){}
  36. if(func(dados) === true){}
  37. if(func(dados) == 1){}
  38. if(func(dados) === 1){}
  39. if(func(dados) === "1"){} //a parte de == ou === tentei também e vale para os demais
  40. if(func(dados) === "true"){}
  41. if(func(dados) === 'true'){}
  42. if(func(dados).val()){}
  43. if(func(dados).value){}
  44. if(func(dados).value === true){}
  45. if(func(dados).val() === true){}
Add Comment
Please, Sign In to add comment