Recibir array desde php
Publicado por Ro (11 intervenciones) el 13/07/2019 19:10:58
Buenas. Estoy intentando recibir una array desde php y al recibirlo por js pintar esos datos en mi html.
El código es este:
-- php "procesando.php"
-- js "index.php"
El código es este:
-- php "procesando.php"
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
if (isset($_POST['cliente_grabar'])){
$id_cliente = $_POST['cliente_grabar'];
$fecha_factura = $_POST['fecha_grabar'];
$data = new clientes($id_cliente);
$datos_cliente_cabecera = $data->getDatosCliente($id_cliente);
$nombre = $data->getNombre();
$rs = $data->getRs();
$cif = $data->getCif();
$fp = $data->getFp();
$nueva_factura = $data->guardaCabeceraCliente($id_cliente,$fecha_factura);
$factura = $data->getFactura();
$datos=array("nombre"=>$nombre,
"rs"=>$rs,
"cif"=>$cif,
"fp"=>$fp,
"factura"=>$factura);
echo json_encode($datos);
}
-- js "index.php"
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<script language="javascript">
function graba_maestro(){
var cliente = $("#cliente_n").val();
var factura = $("#factura_n").val();
var fecha = $("#fecha").val();
if (cliente != "") {
$.post('procesando.php', {cliente_grabar: cliente,factura_grabar: factura,fecha_grabar:fecha}, function(resultado) {
Aquí es donde necesito recibir ese array para pintar en mi html los valores que contiene el array.
});
}
}
Valora esta pregunta


0