weixin_33743248 2016-02-18 13:03 采纳率: 0%
浏览 129

显示预览文件

It is that I need to send a preview of an image in a div in specific, taking the route of the image stored in the database and for this run a successful Ajax send the image.

success: function(respuesta) {
           var preview = document.getElementById("archivoRadicado").value = respuesta;
           $('#vistaPrevia').innerHTML = '<embed src="'+preview +'"/>';
       },
error: function(xhr,err) { 
           alert("Error");
       }

And the <embed /> html control the path to receiving the route but I did not get anything, no errors or éxtito, I can do or have mistake?

This is where you should go div preview

<div id="vistaPrevia" style="width=100%; height:490px;">    

</div>
  • 写回答

1条回答 默认 最新

  • weixin_33735077 2016-02-18 13:18
    关注

    You have to be sure you write CLEAN code. For starters, the following line is not valid.

    <div id="vistaPrevia" style="width=100%; height:490px;">    
    

    Secondly, you're mixing up jquery and javascript. Stick to one, either jquery or javascript, since you have to initiate either one or the other, I believe, at least to my understanding, that you mustn't mix languages like this. If you decide to use jquery, change this line...

    $('#vistaPrevia').innerHTML = '<embed src="'+preview +'"/>';
    

    ...to this

    $('#vistaPrevia').html('<embed src="'+ preview +'"/>');
    

    Hope this helps.

    评论

报告相同问题?

悬赏问题

  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 unity第一人称射击小游戏,有demo,在原脚本的基础上进行修改以达到要求
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)