Skip to content

Instantly share code, notes, and snippets.

@bogdan
Created October 25, 2010 09:05
Show Gist options
  • Save bogdan/644648 to your computer and use it in GitHub Desktop.
Save bogdan/644648 to your computer and use it in GitHub Desktop.
$('html').ajaxSuccess(function(event,request,options) {
var data = null;
try {
data = $.parseJSON(request.responseText);
} catch(e) {
// well... this is hacky and we're parsing all incoming ajax responses. i'd really like to do this in a nicer way
}
if ((data!==null) && (data.flash!==null)) {
$.each(data.flash, function(k,v) {
$.flash(v, {type: k});
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment