Skip to content

Instantly share code, notes, and snippets.

@jaredfaris
Created July 4, 2012 21:10
Show Gist options
  • Save jaredfaris/3049536 to your computer and use it in GitHub Desktop.
Save jaredfaris/3049536 to your computer and use it in GitHub Desktop.
Functionalizing JavaScript 1
$('#someElement').on('click',
function() {
var objectId = $(this).data('objectid');
$.ajax({
url: "/some/path",
type: "POST",
data: {
objectId: objectId
},
success: function() {
$('div[data-objectid="' + objectId + '"]').remove();
if($('#parentContainer div').length == 0){
$('#parentContainer').hide();
}
}
});
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment