I need your help, gentlemen. You see I want to send the value of 3 variables which come from several fields of a form, except one which I pass to javascript from PHP. If you are wondering if those variables load the values, I say yes. I already tried that, using "alert ();"
The problem is that only the first of them registers in the BD, the others do not do anything, they do not appear.
JQUERY
<script type="text/javascript">
$(document).ready(function(){
$('#btnGL').click(function(){
var id_post = $('#bookId').val();//Obtener valor del campo con el ID del post
var id_usuario = <?php echo $id_user ?>;//Obtener ID del usuario que hizo el post
var obtenerBallon = $('#ageOutputId').val();//Obtener valor del campo cantidad de ballons
alert(id_usuario);
alert(id_post);
var datos = 'idPost='+ id_post + 'idUsuario='+ id_usuario + 'puntos='+
obtenerBallon;
$.ajax({
type:'POST',
url:'VotosGL.php',
data:datos,
success:function(result){
alert(result);
}
});
});
});
</script>
PHP VotosGL.php
<?php
include('conexion.php');
$id_post = $_POST['idPost'];
$id_usuario = $_POST['idUsuario'];
$puntos = $_POST['puntos'];
$insert = mysqli_query($conn, "INSERT INTO posts_votos
(id_post,id_usuario,puntos) VALUES('$id_post','$id_usuario','$puntos')");
?>