Jump to content


Photo

Dúvida sobre ".done"

Javascript Js .done get

  • Faça o login para participar
3 replies to this topic

#1 Lucas99

Lucas99

    Normal

  • Usuários
  • 84 posts
  • Sexo:Masculino
  • Localidade:Santos

Posted 24/12/2015, 03:02

Gostaria de tirar uma dúvida bem simples... qual ou quais as diferenças de usar... por exemplo:

$.get("myurlhere.php", function() {
    var a = x;
    var b = y;
    $.get("myurlhere.php", {
        valora: a,
        valorb: b
    })
});e usar:
$.get("myurlhere.php", function() {
var a = x;
var b = y;
}).done(function() {
$.get("myurlhere.php", {
valora: a,
valorb: b
})
});

Não sei se a questão é auto-explicativa, mas gostaria de saber se tem alguma diferença em chamar o segundo "get" dentro do primeiro ou fora do mesmo através do done.

 



#2 Danilomaru

Danilomaru

    Ativo

  • Moderadores
  • 300 posts
  • Sexo:Masculino
  • Localidade:brasil

Posted 11/01/2016, 05:57

Não há diferenças em execução.

Mas utilizando o "done", ou seja", promises você consegue ter uma melhor organização do código. Veja:

 
$.get("myurlhere.php")
.then(function() {
var a = x; //não entendi de onde vem x e y
var b = y;
return true;
})
.then(function() {
return $.get("myurlhere.php", {
valora: a,
valorb: b
});
})
.then(function(result) {
console.log(result);
});
Fazendo um encadeamento do código assíncrono. 


#3 RonsisM

RonsisM

    Super Veterano

  • Usuários
  • 15724 posts
  • Sexo:Masculino
  • Localidade:Plovdiv

Posted 25/09/2017, 15:38

Viagra Online Bari Buy Synthroid No Prescription cialis Baclofene Ou Le Trouver Acquisto Sildenafil 25 Mg

#4 JeffMalm

JeffMalm

    Super Veterano

  • Usuários
  • 12254 posts
  • Sexo:Feminino
  • Localidade:Mount Carey

Posted 13/02/2023, 14:53

donde comprar priligy mexico Gnrh analogs of specific fertility medication tried calling me to mice and test ccct to induce ovulation
This was a large, double blind, randomized, non inferiority superiority comparison of anastrozole n 3, 125 with tamoxifen n 3, 116 or a combination of anastrozole and tamoxifen n 3, 125 for 5 years in PMW with EBC better business bureau online pharmacy priligy
comprare lasix lesbian doctoirs slutload largest sex orgy share girfriend fuc achie veronica betrty nure drawings teen annd gfief andd losds heasvy dury viibrator hhot poov threesome
Humans are less sensitive to light than mice are, so it s not clear what level of light exposure would disrupt melatonin production in people nolvadex for men Weinstein, who is coordinating the program at the Mount Holly hospital with Annette Conklin, the hospital s director of oncology





Veja alguns posts relacionados com: Javascript, Js, .done, get

0 user(s) are reading this topic

0 membro(s), 0 visitante(s) e 0 membros anônimo(s)

IPB Skin By Virteq