我有两个页面:parse.php和media.php。在parse.php我有代码:
<img src="http://localhost/dev4/admin/media.php/jjjffjjff"></img>
现在在media.php上我有这样的代码
<script>
$(document).ready(function(){
var uri='<?php echo $_SERVER['PATH_INFO']; ?>';
var access_token = '<?php echo $_COOKIE['user_access_token'];?>';
$.ajax({
type: "POST",
url: 'get_media',
dataType: "JSON",
data: {
access_token: access_token,
source_uri:uri
},
async: false,
success:function(data){
var text="<img src='http://pad2.whstatic.com/images/thumb/e/e0/Rotate-in-Volleyball-Step-4.jpg/670px-Rotate-in-Volleyball-Step-4.jpg'";
$('body').html(text);
},
error:function(status){
console.log('Error '+status);
}
});
});
</script>
图片将是动态的
当我直接检查 media.php / jjjffjjff 时,我的图像即将到来。为什么它不会出现在parse.php上?
答案 0 :(得分:0)
尝试替换
var text="<img src='data.media[0]['media']";
带
var text='<img src="' + data.media[0]['media'] + '">';