Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
insert_comment = ($comments, comment_data) ->
# add this comment into the given $comments div somehow
$ ->
# create $comments
$comments = $('<div id="comments">')
$.get '/posts/123/comments.json', (comments_data) ->
for comment_data in comments_data
insert_comment $comments, comment_data
$comments.appendTo 'somewhere'
#on_somehow_loading_new_comment (comment_data) ->
# insert_comment $comments, comment_data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment