I have a javascript function that has AJAX code inside it. I want to pass the values from javascript to AJAX, follow the code:
function validarCamposComprar() {
var campoNomeEmpresa = document.getElementById('fTxtCadastroNomeEmpresa');
var campoNomeAdmin = document.getElementById('fTxtCadastroNomeAdmin');
$.ajax({
type: "POST",
url: "email.php",
data: { meuParametro1: campoNomeEmpresa, meuParametro2: campoNomeAdmin },
complete: function (data) {
// (...)
}
});
return true;
}
Is it possible to do this, what am I missing?