I have this code:
$('.be-delete').live('click', function(e){
e.preventDefault();
var object =$(this);
var url = $(this).attr('href');
$.ajax({
url : url,
error : function(){alert('An error has occurred, no updates were made')},
success : function(){
object.parent().fadeOut('slow', function(){object.parent().remove()});
}
});
});
$('.be-delete').ajaxStart(function(){
$(this).parent().html('<img src="' + base_url + 'media/images/jquery/spinner.gif' + '"/>');
});
the problem is $(this) on the ajaxStart callback is not working and all li's are affected! my html markup is as follows:
<li><img src="1.jpg"/><a class="be-delete"href="#">Delete</a></li>
<li><img src="2.jpg"/><a class="be-delete"href="#">Delete</a></li>
<li><img src="3.jpg"/><a class="be-delete"href="#">Delete</a></li>
how do I capture the ajaxStart event for only one li?