-1
Meine Frage bezieht sich auf diese Antwort. Bootstrap open image in modalBootstrap Bild in Modal mit dynamischem Bild öffnen src
Wie kann ich Bilder anzeigen, die src stammt aus MySQL-Datenbank?
Meine Frage bezieht sich auf diese Antwort. Bootstrap open image in modalBootstrap Bild in Modal mit dynamischem Bild öffnen src
Wie kann ich Bilder anzeigen, die src stammt aus MySQL-Datenbank?
einfach echo
die img Quelle aus der Datenbank.
<?php
if(isset($_POST['profile_id'])){
var uid=$_POST['profile_id'];
$result->query("SELECT profile FROM user WHERE uid=$uid");
$row=$result->fetch_array();
die(json_encode($row));
}
?>
HTML:
<a href="#" class="pop">
<img src="" style="width: 400px; height: 264px;">
</a>
JQuery Teil:
$.post("ajax.php",{profile_id:1},function(response){
if(response){
var profileImg=JSON.parse(response);
profileImg=profileImg[0].profile;
$('.pop img').attr('src','http://example.com/image/'+profileImg);
$('.pop').modal('show');
}
});
Sarath weiß, dass ich den PHP-Teil. Ich möchte wissen, wie Bilder in Modal mit Jquery und Bootstrap angezeigt werden. – JayV
@JayV siehe aktualisierte Antwort –