Why the following script works on the client side by deleting the relievant html object:
$(".ui-delete").click(function() {
$.ajax({
url: 'delete.aspx',
type: 'POST',
data: { strWidgetID:$(this).parents(".widget").attr("id") },
error: function() { alert('Error'); },
success: function() { alert('Success'); }
});
$(this).parents(".widget:first").remove();
});
But the following query, which is โmore correctโ, does not work when deleting the html object?
$(".ui-delete").click(function() {
$.ajax({
url: 'delete.aspx',
type: 'POST',
data: { strWidgetID:$(this).parents(".widget").attr("id") },
error: function() { alert('Error'); },
success: function() {
alert('Success');
$(this).parents(".widget:first").remove();
}
});
});
The first script works correctly both on the client side and on the servers, the second script does the servers correctly, but on the client side it simply displays a success warning, but does not delete the html widget object
Any ideas?
source
share