Created
April 18, 2017 03:45
-
-
Save corean/cee1e234ba6d56dd5953f27a062ea2d0 to your computer and use it in GitHub Desktop.
CRUD중 Delete를 AJAX로 처리
This file contains hidden or 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> | |
$.ajaxSetup({ | |
headers: { | |
'X-CSRF-TOKEN': '{{csrf_token()}}' | |
} | |
}); | |
$('.btn__delete').on('click', function (e) { | |
var boardID = '{{ $board->id }}'; | |
var boardUri = '{{ $board->board_uri }}'; | |
if (confirm('글을 삭제합니까?')) { | |
$.ajax({ | |
type: 'DELETE', | |
url: '/admin/boards/' + boardUri + '/' + boardID | |
}).then(function () { | |
window.location.href = '/admin/boards/' + boardUri; | |
}); | |
} | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment