I am not to getting the values from the result of the AJAX call. I return JSON but I do not know how to get a value. This is my code:
$.ajax({
method: 'POST',
dataType: 'json',
url: 'queryProduct.php',
data: { codigo: cod }
}).done(function(response){
// How do it get values???
});
PHP file result:
$query = "SELECT * FROM produccion.ma_producto WHERE codigo={$codigo}";
$result = pg_query($conn, $query);
if (!$result) {
echo "Error query: " . pg_last_error($conn);
} else {
header('Content-type: application/json; charset=utf-8');
echo json_encode($result);
}
From the first jquery call php file with ajax and after I would like to get the values and set to others elements....