Created
January 24, 2012 04:04
-
-
Save nhajratw/1667727 to your computer and use it in GitHub Desktop.
Getting Backbone to communicate with XML services using CoffeeScript
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
# Keep track of the original sync method so we can | |
# delegate to it at the end of our new sync. | |
originalSync = Backbone.sync | |
# Our new overriding sync with dataType and ContentType | |
# that override the default JSON configurations. | |
Backbone.sync = (method, model, options) -> | |
options = _.extend(options, | |
dataType: 'xml' | |
contentType: 'application/xml' | |
processData: false | |
) | |
originalSync.apply(Backbone, [ method, model, options ]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment