Skip to content

Instantly share code, notes, and snippets.

@AndrewHenderson
Created December 31, 2012 21:58
Show Gist options
  • Save AndrewHenderson/4423101 to your computer and use it in GitHub Desktop.
Save AndrewHenderson/4423101 to your computer and use it in GitHub Desktop.
Cloudant Example
// Parse the json from the text area
var doc = $.parseJSON($('#newdoc').val());
// "connect" to the database
var db = $.couch.db(user_db);
// insert the doc into the db
db.saveDoc(doc, {
success: function(response, textStatus, jqXHR){
// do something if the save works
},
error: function(jqXHR, textStatus, errorThrown){
//do something else if it goes wrong
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment