I have the following 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>
When the user clicks profileButton I call the following jquery which calls the db, when it returns I want to change the thumbnail background color to yellow so it notifies the user as follows:
$('.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;
});
but i see the alert message but the background does not change and remains white, can someone please tell me what I'm doing wrong here ?