从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!

try to use prop function:

$("#imagen").prop("src",data);