Skip to content

Instantly share code, notes, and snippets.

@yevgnenll
Created January 9, 2017 13:56
Show Gist options
  • Save yevgnenll/cca4df3fa4cbd65ade5336672fc88e6e to your computer and use it in GitHub Desktop.
Save yevgnenll/cca4df3fa4cbd65ade5336672fc88e6e to your computer and use it in GitHub Desktop.
$('.comment-area').on('click', '.user_block' , function (event) {
var user_id = this.getAttribute("data-user-id");
if(confirm('해당 user를 차단하시겠어요?')) {
$.ajax({
'url': '/blocks/user/',
'type': 'POST',
'data': {'user': user_id},
success: function (data, text, xhr) {
if(xhr.status === 201) {
}
console.log('success' ,data, text, xhr);
}, error: function (data, text, xhr) {
console.log('error' ,data, text, xhr);
}
});
}
});
@yevgnenll
Copy link
Author

  • $('.comment-area') 는 1개 이상일경우
  • .comment-area는 data-user-id를 가지고 있기 때문에 각각 가져와야해서 this를 사용해야할때

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment