-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 carousal:打开点击图像
- 4. Android:使用图库打开图像,但使用其他图像
- 5. 动态分配图像src到画布
- 6. 从xml动态添加图像和src
- 7. 动态JavaScript图像SRC路径替换
- 8. 在Bootstrap中使用资产/图像中的图像
- 9. phantomjs使用SRC图像
- 10. Modal中的图像映射
- 11. PhotoSwipe使用图像打开图库
- 12. 提取图像src并使其成为另一图像的src
- 13. 如何使用scrapy提取动态加载的图像的src
- 14. 图像缩放+ Modal?
- 15. 如何打开多个图像的模态图像
- 16. 打开图像? Python
- 17. 图像下载 - 图像无法打开
- 18. 删除图像动态使用jQuery通过清除src属性
- 19. 使用Chrome下载的打开图像
- 20. 用Python打开图像PIL
- 21. 如何使用图像的src为所有图像的src填充alt字段
- 22. 在Rails 4中动态添加图像到Bootstrap Carousel应用
- 23. jquery和php,加载图像并使用每个图像的src
- 24. 如何打开图像并使用ImageMagick重新保存图像?
- 25. 使用文件路径在图库中打开图像
- 26. 在python中打开http的图像3
- 27. 设置图像数据为图像src
- 28. 使用ng-src的图像不加载
- 29. 使用Wordpress设置图像的SRC get_option
- 30. 使用python打开.raw图像数据
萨拉特我知道PHP的一部分。我想知道如何使用jquery和bootstrap以模态显示图像。 – JayV
@JayV请看到更新的答案 –