I have a request ajax
so
$.ajax({
type: "POST",
data: "valor="+val,
url: "ajax/mostra_imagens.php",
success: function(e){
console.log(e);
}
});
On page mostra_imagens.php
it creates a array
which in turn is received in the variable e
but how do I make the variable e
be a array
and not a string
?
show_pictures.php
<?php
require "../../ligacao.php";
$array = array();
$query=mysqli_query($db, "SELECT * FROM publicidades_sponsors where id_publicidade = '".$_POST['valor']."'");
while($mostra=mysqli_fetch_assoc($query)){
$array[] = $mostra['nome'];
}
print_r($array);
?>
What console.log(e)
returns
Array
(
[0] => DIDAXIS1.png
[1] => DIDAXIS2.png
[2] => DIDAXIS3.png
[3] => DIDAXIS4.png
)
It returns different data depending on what is selected in select