Partner I'm trying to send data from a JS to a PHP that allows me to generate a PDF document, here the JS.
var IDencuestapdf;
var IDcontratopdf;
var IDuserpdf;
function generarPDF (){
IDencuestapdf = $('#idencuesta').val();
IDcontratopdf = $('#idcontrato').val();
IDuserpdf = $('#idusuario').val();
dataString = {
'IDencuestapdf' : IDencuestapdf,
'IDuserpdf' : IDuserpdf,
'IDcontratopdf' : IDcontratopdf
};
$.ajax({
type: "POST",
url: "PDF.php",
data: dataString,
success: function() {
location.href ="PDF.php?pdf=1";
}
});
}
The problem is that I apply fixed data in PHP and it calls me the PDF data according to that data, but when I try to put the data as they are called from the JS, I get the variables without undefined, here the PHP.
PDF.php
<?php
session_start();
/* Datos fijos usados para hacer las consultas
$IDencuesta = 19;
$IDcontrato = 2;
$IDuser = 3;
*/
$IDencuesta = $_POST['IDencuestapdf'];
$IDcontrato = $_POST['IDcontratopdf'];
$IDuser = $_POST['IDuserpdf'];
include ('conexion.php');
etc...
?>