1
I’m having trouble sending an Ajax variable to PHP, the situation is as follows:
Through a while
, are listed all albums available in the database:
include './bd/conecta.php';
$sql = "SELECT * FROM album";
$query = mysql_query($sql);
while ($row = mysql_fetch_array($query)) {
echo '<a href="">' . '<img width="100px" heigth="100px" src="' . $row['capa_album'] . '" onclick="alb(' . $row['id_album'] . ')" ></a>';
}
Ai with the Ajax code I can visualize this id_album
through a alert
, but I can’t send this variable id_album
to the page fotos.php
.
function alb(codigo) {
$.ajax({
url: 'fotos.php',
cache: false,
type: 'POST',
data: 'id_album=' + codigo,
success: function(data) {
alert(codigo);
}
});
};
Actually not even redirecting is to the page photos.php, anyone can help me?