我想在$currentsong中添加#track-title的值…
i want set the SRC of attrimg .
这可能吗?还有其他想法吗?
<script>
function radioTitle() {
$.ajax({
type: 'GET',
url: 'http://radio.example.com:8000/json.xsl',
async: true,
jsonpCallback: 'parseMusic',
contentType: "application/json",
dataType: 'jsonp',
success: function(json) {
$('#track-title').text(json['/radio']['title']);
//here i need help!!!
$('img.image').attr({src: '<?PHP echo "/blablabla/".$currentsong.".jpg";?>'});
},
error: function(e) {
console.log(e.message);
}
});
}
$(document).ready(function(){
setTimeout(function(){radioTitle();}, 0000);
setInterval(function(){radioTitle();}, 5000);
});
嗯…"http://radio.example.com:8000/json.xsl"的回应,…必须包含图像url或图像文件路径。如果响应有一个图像,json['/radio']['imageurl']指向图像的url(或路径),然后
$('img.image').attr({src: '<?=$image_dir_path?>/' + json['/radio']['imageurl']});