Created
May 25, 2011 09:14
-
-
Save jakcharlton/990648 to your computer and use it in GitHub Desktop.
How do I return 'data' as the result of save_it ?
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
# How do I return 'data' as the result of save_it ? | |
save_it = (edited_value, s) -> | |
$.post(url_to_save_to, {value: edited_value}, (data) -> data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
By the way, if instead of
$.post
you were calling something that synchronously runs its callback, then you could writeto return the value provided by
runNow
fromsave_it
. (Thedata = null
line is necessary to givedata
scope outside of the callback.)