It it my code
$(".library-fields-container div.field-content img").click(function(){
var nid = getImageNodeID($(this).siblings(".image-span").text());
$.ajax({
url: Drupal.settings.basePath + 'views/ajax',
type: 'POST',
dataType: 'json',
data: 'view_name=fehrest&view_display_id=block_1&view_args='+nid,
success: function(response) {
var output = response[1].data;
alert(output);
$(this).hide();
},
error: function(data) {
alert('An error occured!');
}
});
});
I'm sure the output
variable prints something and it is not empty, because the alert function displays it's content.
The problem is it doesn't hide the $(this)
while when I put the
$(this).hide();
At the beginning of the click event just before the Ajax call it hides the image.
What is the Ajax callback function with $(this)
object?