我想在某個類中定位某個div,我會使用$(this),但這不起作用,因爲我從另一個函數調用該類。如何定位在ajax內類中被點擊的元素
示例代碼。
$(document).on('click', '.Player', function(e){
var id = $(this).find('.Song_Id').html();
$.ajax({
type:"POST",
data: {data:id},
complete: function(){
$(this).attr('src', '../images/appicons/2/16x16/refresh - Red.png')
},
url:"php/player/get_song.php"
}).done(function(f){
$('#Song_info').html(f)
});
})
從上面,下面是一行我不知道該怎麼impliment。
$(this).attr('src', '../images/appicons/2/16x16/refresh - Red.png'),
它假定目標類「.player」,但不是整個類,只有被點擊的元素。
謝謝。