Skip to content

Instantly share code, notes, and snippets.

@anutron
Created August 6, 2009 19:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anutron/163492 to your computer and use it in GitHub Desktop.
Save anutron/163492 to your computer and use it in GitHub Desktop.
Request.JSON = new Class({
Extends: Request,
options: {
secure: true
},
initialize: function(options){
this.parent(options);
this.headers.extend({'Accept': 'application/json', 'X-Request': 'JSON'});
},
success: function(text){
try {
this.response.json = JSON.decode(text, this.options.secure);
this.onSuccess(this.response.json, text);
} catch(error) {
this.fireEvent('exception', [text, error]);
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment