-1
A
回答
0
只是echo
來自數據庫的img源代碼。
<?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的部分:
$.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');
}
});
相關問題
- 1. Bootstrap響應src的圖像
- 2. 如何使用[src]在Angular 2中動態顯示圖像?
- 3. Bootstrap 3 Modal:`data-remote`加載圖像
- 4. 在Android中使用默認圖像查看器打開圖像
- 5. 如何使用動態ul中的next()獲取圖像src
- 6. Bootstrap carousal:打開點擊圖像
- 7. Android:使用圖庫打開圖像,但使用其他圖像
- 8. 從xml動態添加圖像和src
- 9. 動態JavaScript圖像SRC路徑替換
- 10. 動態分配圖像src到畫布
- 11. 更改圖像SRC圖像
- 12. 在Bootstrap中使用資產/圖像中的圖像
- 13. 在UIWebview中打開圖像
- 14. 在圖像中打開URL
- 15. Primefaces打印動態圖像
- 16. 如何使用$ .ajax將圖像src設置爲動態圖像/ png數據?
- 17. Modal中的圖像映射
- 18. phantomjs使用SRC圖像
- 19. PhotoSwipe使用圖像打開圖庫
- 20. 如何使用scrapy提取動態加載的圖像的src
- 21. 提取圖像src並使其成爲另一圖像的src
- 22. Bootstrap Modal未使用javascript方法打開
- 23. 如何在圖像內放置關閉圖標:bootstrap 3 modal
- 24. 圖像縮放+ Modal?
- 25. 如何打開多個圖像的模態圖像
- 26. 在圖庫中打開遠程圖像
- 27. bootstrap動態圖像生成集寬度=
- 28. Bootstrap模態圖像背景
- 29. 打開圖像? Python
- 30. 圖像下載 - 圖像無法打開
薩拉特我知道PHP的一部分。我想知道如何使用jquery和bootstrap以模態顯示圖像。 – JayV
@JayV請看到更新的答案 –