Created
June 1, 2016 05:16
-
-
Save l02162010/1647ed25ac747c40497573200ac6b521 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
<script> | |
$(document).ready(function () { | |
var actionForm = $('#actionForm'); | |
var deleteBtn = $('.btn.delete'); | |
var updateBtn = $('.btn.update'); | |
deleteBtn.click(function () { | |
if (!confirm("are you sure?")) { | |
return false; | |
} | |
actionForm.attr('action', '/admin/item/delete/' + $(this).attr('data-id')); | |
actionForm.removeAttr('enctype'); | |
actionForm.submit(); | |
}); | |
updateBtn.click(function () { | |
actionForm.attr('action', '/admin/item/update/' + $(this).attr('data-id')); | |
actionForm.attr('enctype', 'multipart/form-data'); | |
actionForm.submit(); | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment