dongzhao1930 2014-09-24 19:09
浏览 971
已采纳

从AJAX请求更改图像src

I have been trying a lot of different ways to make a change on a image src from a AJAX Requset, the new URL is retrived from an AJAX call, with the Developer Tools i visualized data the returning variable 'DATA' have the expected URL but the image SRC get this:

"atrk.js-; var s = document.getElementsByTagName('script')[0];s.parentNode"


The AJAX Request:

$.post("readurl.php",function(data){
      $("#imagen").attr("src",data);     
 });

The HTML Element:

<img id="imagen" src="old_pic.png">

The PHP file:

<?php
$xml=simplexml_load_file("links.xml");
echo $xml->URL_one;
?>

I hope someone can help me.

Thanks in advance!

  • 写回答

1条回答 默认 最新

      报告相同问题?

      相关推荐 更多相似问题

      悬赏问题

      • ¥50 需要加权最小二乘Python代码
      • ¥15 hanzi-writer生成的svg外有一层div,修改div宽高影响的是画布大小,字体在不同视口下完全不相同。我想要让字体跟画布同比例大小该怎么实现?
      • ¥15 Java集合多对一问题集
      • ¥20 PowerShell如何操作记事本?
      • ¥15 intel网卡固件降级失败
      • ¥20 html使用模型的问题
      • ¥15 这些怎么解题啊来个人
      • ¥15 h5套壳IOS Cordova依赖找不到导致编译失败
      • ¥15 分组密码算法misty1的子密钥生成算法c++实现
      • ¥15 vscode的一些报错,希望可以得到解决