<?php

header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Headers: *');

require '../../modelo/ad_header.php';
$response = array();

if (
    !isset($_POST['id_ad_header'])
) {
    $response['response'] = 'error';
    $response['data'] = 'Datos incompletos';
    echo json_encode($response);
    return;
}

$id_ad_header = $_POST['id_ad_header'];

$ad_headers = AdHeader::mdlGetAdHeaderById($id_ad_header);

if (!$ad_headers) {
    $response['response'] = 'error';
    $response['data'] = 'No se encontraron ad_headers';
    echo json_encode($response);
    return;
}

$response['response'] = 'success';
$response['data'] = $ad_headers;
echo json_encode($response);
return;
