<?php
require("../connection.php");

$id = $_POST['id'];

$query = mysqli_query($con, "SELECT location FROM asset_master WHERE id='$id'");
$result = mysqli_fetch_assoc($query);
$location_id = $result['location'];
$location = mysqli_fetch_array(mysqli_query($con, "SELECT location FROM location_master WHERE id=$location_id"));
if ($result) {
    echo json_encode($location);
} else {
    echo json_encode([ 'location' => '']);
}
?>
