Created
January 28, 2015 02:57
-
-
Save simonw/aaabe56340c99819cb23 to your computer and use it in GitHub Desktop.
Using gist.github.com to persist data from JavaScript running on any webpage
This file contains 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
jQuery.get('https://api.github.com/gists/3a065d804c44b0149eac', function(data) { | |
console.log(data.files['file1.txt'].content) | |
}); |
This file contains 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
jQuery.post('https://api.github.com/gists', JSON.stringify({ | |
"description": "Saving some data", | |
"public": true, | |
"files": { | |
"file1.txt": { | |
"content": "Contents of file" | |
} | |
} | |
}), function(data) { | |
console.log("Data has been saved to", data.html_url) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment