I'm trying to pass values through two variables in AJAX to a PHP file, but it's not working. if I put date: {idUsuario: "5", idChoose: "1",} sure. What is wrong?
$(document).ready(function(){
$("#botao").click(function(){
var url = "InserirEscolha.php";
$.ajax({
var idUsuario = "5";
var idEscolha = "1";
type: 'post',
url: 'UpdateVisto.php',
data: { idUsuario: idUsuario, idEscolha: idEscolha, }
});
$.post(url, function(result) {
});
});
});
<?php
$idUsuario = $_POST['idUsuario'];
$idEscolha = $_POST['idEscolha'];
include "config_sistema.php";
$query = mysql_query("INSERT INTO usuario_escolha
(id_usuario, id_escolha)
VALUES('{idUsuario}','{$idEscolha}')");
if ($query){
header("Location: perfil.php?ID=$idUsuario");
}
?>