Friends, I'm doing an AJAX with PHP but the registry is going empty. What am I doing wrong?
function newColor() {
var nome = document.getElementById("descricao_cor").value;
var cor = document.getElementById("hexadecimal").value;
alert (nome);
alert(cor);
$.ajax({
url: "atualiza-cor.php",
type: "GET",
data: { descricao_cor: "nome", hexadecimal: "cor" },
cache: false,
success: function() {
document.adm.submit();
$('#btnSelecionar').trigger('click');
}
});
}
The alerts work fine. And then PHP looks like this:
//NOVA COR
if (isset($_GET['novaCor']) && ($_GET['novaCor']) != '') {
echo $sql_novacor = 'INSERT INTO veiculos0_cores (descricao_cor,relevancia,hexadecimal) VALUES("' . $_POST['nome'] . '","", "' . $_POST['cor'] . '")';
mysql_query($sql_novacor) or die(mysql_error());
}
And a record is inserted, but it is empty. I'm not finding the problem. Someone help me, please?
[]'s