Created
December 31, 2012 21:58
-
-
Save AndrewHenderson/4423101 to your computer and use it in GitHub Desktop.
Cloudant Example
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
// 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