Skip to content

Instantly share code, notes, and snippets.

@Aupajo
Created March 16, 2009 22:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Aupajo/80134 to your computer and use it in GitHub Desktop.
Save Aupajo/80134 to your computer and use it in GitHub Desktop.
jQuery HTTP DELETE links
$(document).ready(function() {
$('.delete').click(function() {
if(confirm('Are you sure?')) {
var f = document.createElement('form');
$(this).after($(f).attr({
method: 'post',
action: $(this).attr('href')
}).append('<input type="hidden" name="_method" value="DELETE" />'));
$(f).submit();
}
return false;
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment