Created
June 1, 2015 12:54
-
-
Save fabrinal/59194a226c085719237a to your computer and use it in GitHub Desktop.
Add ajax to delete single photo
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 -> | |
$('.delete_photo').each -> | |
$(this).click -> | |
if confirm("Are you sure to delete photo?") | |
photo_id = $(this).attr('data-value') | |
$(this).on "ajax:success",() -> | |
alert("Photo deleted successfully") | |
$("a[data-value="+photo_id+"]").remove() | |
$("#photo"+photo_id).remove() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment