Skip to content

Instantly share code, notes, and snippets.

@spro
Last active December 27, 2015 15:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spro/7345254 to your computer and use it in GitHub Desktop.
Save spro/7345254 to your computer and use it in GitHub Desktop.
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