Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
360 views
in Technique[技术] by (71.8m points)

如何让后台获取的图片在页面显示出来

success:function(data){

                issueType = data.issueType;    
                console.log(data.lstFile);
                aba.innerHTML = "";                    
                var fileName;
                var len = data.lstFile.length;

// document.getElementById("imgSrc").src = baseServerUrl+ fileUrl;

                for(var i = 0; i < len; i++){
                    var li = document.createElement("li");
                    var fileUrl = data.lstFile[i].fileUrl;
                    li.className = "mui-table-view-cell mui-table";
                    li.innerHTML = "<label>附件内容:</label>"+"<span>"+data.lstFile[i].fileName+"</span>"+"<img id='imgSrc' src=''>";
                    aba.appendChild(li);

// console.log(data.lstFile.length);
// console.log($("#imgSrc").attr("src"));

                    $("#img").attr("src","http://218.17.104.170:8082/upload/attachment/20170412070145109.jpg");`![请输入代码][1]`

求大神指教指教,已经困扰几天了


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

id搞错了了,应该是$("#imgSrc").attr("src","http://218.17.104.170:8082/upload/attachment/20170412070145109.jpg");


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...