Skip to content

Instantly share code, notes, and snippets.

@0xBADC0FFEE
Last active December 22, 2015 04:49
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 0xBADC0FFEE/6420098 to your computer and use it in GitHub Desktop.
Save 0xBADC0FFEE/6420098 to your computer and use it in GitHub Desktop.
$.getJSON('/api/post.json')
.then (response) ->
# do something
response # if you would not return anything, promise would be fulfilled with undefined
.then (response) ->
# do something
undefined # necessary to prevent non-empty function body
.then null, (err) ->
# handle error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment