我正在尝试将图片插入img标签。从PHP我拍摄的图像(blob)
PHP:
$id = $_POST["fotoID"];
$sql = "SELECT F.data
FROM foto AS F
WHERE F.fileid = '$id'";
$result = mysql_query("$sql") or die("1Errore: ".mysql_error());;
$row = mysql_fetch_assoc($result);
header("Content-type: image/jpeg");
echo $row['data'];
来自ajax:
$.ajax({
url: 'foto.php',
type: 'POST',
data: {
fotoID: element.FK_foto
},
statusCode: {
200: function (uscita) {
swal("riuscito");
console.log(uscita);
$("#fotoApp").append(uscita);
}
}
但是在结果中我有代码中的img ...有什么想法吗?