Skip to content

Instantly share code, notes, and snippets.

@jejacks0n
Created July 8, 2011 21:30
Show Gist options
  • Save jejacks0n/1072870 to your computer and use it in GitHub Desktop.
Save jejacks0n/1072870 to your computer and use it in GitHub Desktop.
Creating content with Mercury by overriding save.
new Mercury.PageEditor('/path/to/your/controller');
Mercury.PageEditor.prototype.save = function() {
jQuery.ajax(this.saveUrl, {
type: 'POST',
data: {content: jQuery.toJSON(this.serialize()), _method: 'put'},
success: function() { Mercury.changes = false },
error: function() { alert("Mercury was unable to save to the url: " + this.saveUrl) }
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment