我有以下HTML
<div class="col-lg-4 col-md-4 col-sm-3">
<div class="thumbnail">
<img src="http://res.Domain.com/dncu6pqpm/image/upload/q_80,c_fill,h_200,w_320/ImageName.jpg">
<div class="caption">
<p align="center">
<input id="IsProfilePic" class="btn btn-primary btn-block profilebutton" type="button" value="Profile Picture" data-id="1">
</p>
<p align="center">
<input id="IsDelete" class="btn btn-danger btn-block deletebutton" type="button" value="Delete Picture" data-id="1">
</p>
</div>
</div>
</div>
当用户点击profileButton时,我调用以下调用db的jquery,当它返回时我想将缩略图背景颜色更改为黄色,以便按如下方式通知用户:
$('.profilebutton').on("click", function () {
$.ajax({
url: 'Url for method',
data: { "pictureId": $(this).attr("data-id") },
cache: false,
type: "GET",
success: function (result) {
alert('here');
$(this).closest("div.thumbnail").css("background-color", "yellow");
},
error: function (result) { }
});
return false;
});
但是我看到提醒信息,但背景没有改变并保持白色,有人可以告诉我我在这里做错了吗?