I don’t know why this working:
$('.deleteQuestion').live('click', function(){
$.ajax({
type: 'GET',
url: '/delete_question/' + $(this).attr('name') + '/',
success: $('[what="question"][name="' + $(this).attr('name') + '"]').remove()
});
});
but this not working:
$('.deleteQuestion').live('click', function(){
$.ajax({
type: 'GET',
url: '/delete_question/' + $(this).attr('name') + '/',
success: function(){$('[what="question"][name="' + $(this).attr('name') + '"]').remove();} }
});
});
Does someone know?
The success callback doesn’t operate on the same
thisthat the click handler does. Save it in a variable: