Skip to content

Instantly share code, notes, and snippets.

@ericf
Created December 14, 2009 00:42
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 ericf/255698 to your computer and use it in GitHub Desktop.
Save ericf/255698 to your computer and use it in GitHub Desktop.
_onSuccess : function (txId, r, args) {
var entity = r.responseText;
if (entity && entity.length > 0) {
try {
entity = Y.JSON.parse(entity);
} catch (e) {}
}
if (Y.Lang.isObject(entity) || Y.Lang.isArray(entity) {
// successful JSON parse
} else if (Y.Lang.isString(entity) {
// doesn't look like we could parse the responseText as JSON, but we still have a String to work with
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment