Carlos Rocha Posted November 10, 2016 at 03:52 PM Report #600292 Posted November 10, 2016 at 03:52 PM Gostaria de uma orientação. Em se tratando de formulários, post envio, qual seria a forma mais indicada para se trabalhar? Usando $.post $.post ("_required/email.php", { assunto : $("#assunto").val(), nome : $("#nome").val(), email : $("#email").val(), telefone : $("#telefone").val(), descricao : $("#descricao").val(), qual : $("#qual").val(), }, function(retorno){ if (retorno == "OK") { resposta = "E-mail enviado com sucesso!"; } else { resposta = "Erro no envio do E-mail"; } $(".resposta").css("display", "block"); $(".resposta").html(resposta); } ); Ou usando $.ajax $.ajax({ url: "_required/email.php", type: "POST", data: $("#contato").serialize(), success: function(retorno){ if (retorno == "OK") { resposta = "E-mail enviado com sucesso!"; } else { resposta = "Erro no envio do E-mail"; } $(".resposta").css("display", "block"); $(".resposta").html(resposta); } }); E porquê?
KTachyon Posted November 10, 2016 at 03:53 PM Report #600293 Posted November 10, 2016 at 03:53 PM É a mesma coisa. “There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.” -- Tony Hoare
Carlos Rocha Posted November 10, 2016 at 04:55 PM Author Report #600301 Posted November 10, 2016 at 04:55 PM Obrigado!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now