I have a variable JavaScript
in the following way:
var datos ={Tabla: 'Principal' , CampoConsulta:['Nombre','Apellido_Pa','Apellido_Ma'], DatosConsulta:['Juan Luis','Perez','Martinez'], TipoDato:['s','s','s'], Val:[1,2,3] };
This data I want to pass to PHP
to then create a query MySQL
Ajax
function busquedaFiltros(){
var data = stringify(datos);
$.ajax({
url: '../../php/instancias.php',
type: 'POST',
data: {Funcion: 'Filtros', Datos: data},
})
.done(function(data) {
$("#tbl_TblFil").empty();
$("#tbl_TblFil").append(data);
})
.fail(function() {
console.log("error");
})
}
But already in PHP
I no longer know how to work with JSON data. For example I have an array inside my object json
and I would like to go through it. I have read several things, but they leave me with more questions than answers.