I'm in trouble because I'm passing a couple of parameters from AJAX to PHP but PHP does not collect this data.
function ImprimirFichaUsuario(){
var id = $('#idusuarionuevo').val();
var name = $('#nombrenuevo').val();
//Estos alerts funcionan, sacan los valores, es decir el problema está mas adelante
alert(id);
alert(name);
var params = {
"id" : id,
"noim" : name
};
$.ajax({
type: "POST",
url: "php/app/mantenimientos/phpcontrolusuarios/imprimir.ficha.php",
data : params,
dataType: "json",
encode: true
})
.done(function(data){
...
});}
And in print.ficha.php I have this:
<?php
$id = $_POST['id'];
$nombre = $_POST['noim'];
echo "ID: ";
echo $id;
echo "y nombre ";
echo $nombre; <?
When I see that this file responds, I find that it does not receive the data correctly by POST. Any ideas? Thank you very much in advance Greetings, Ivan.
EDIT:
Thank you very much everyone! I already have it, I worked all the advice, especially the juank, but thanks to Kevin and OscarGarcia for recommending that other way. What helped me most was the console.log in response to AJAX. There I realized that if I collected the data well, and the one that treated them badly in PHP was me xD. Greetings and thanks !!!