-
-
Save fmiopensource/150452 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(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; | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | |
<head> | |
<title>Example removal link</title> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js"></script> | |
<script type="text/javascript" src="/javascripts/application.js"></script> | |
</head> | |
<body> | |
<a href="/articles/1" class="delete">Destroy Article 1</a> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment